Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (studySpotInfo == undefined) {
return;
}
this.setState({ filterSelected: true });
this.props.showSearch(true);
const filterId = id;
if (filterId) {
const filterName = Translations.getName(studySpotInfo.filterDescriptions[filterId]) || '';
if (this.props.activeFilters == undefined) {
this.props.setFilters([ filterId ]);
} else if (this.props.activeFilters.has(filterId)) {
this.props.deactivateFilter(filterId);
Snackbar.show({
duration: Snackbar.LENGTH_SHORT,
title: `${Translations.get('filter_removed')}: ${filterName}`,
});
} else {
this.props.activateFilter(filterId);
Snackbar.show({
duration: Snackbar.LENGTH_SHORT,
title: `${Translations.get('filter_added')}: ${filterName}`,
});
}
} else {
this.props.setFilters([]);
}
}
toast = (text: any, options?: any) => {
const action: any = {}
if (typeof options === 'object') {
Object.assign(action, options)
}
Snackbar.show({
title: text.toString(),
duration: Snackbar.LENGTH_SHORT,
action: Object.keys(action).length ? action : undefined
})
}
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import Colors from 'styles/Colors';
import Snackbar from 'react-native-snackbar';
export default class SnackbarUtils {
static DURATION_SHORT = Snackbar.LENGTH_SHORT;
static DURATION_LONG = Snackbar.LENGTH_LONG;
static DURATION_INDEFINITE = Snackbar.LENGTH_INDEFINITE;
static showWarning(options) {
SnackbarUtils.showAlert({
type: 'warning',
...options,
});
}
static showInfo(options) {
SnackbarUtils.showAlert({
type: 'info',
...options,
});
}