How to use the react-native-snackbar.LENGTH_SHORT function in react-native-snackbar

To help you get started, we’ve selected a few react-native-snackbar examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github josephroquedev / campus-guide / src / containers / discover / StudySpots.tsx View on Github external
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([]);
    }
  }
github smallpath / psnine / psnine / index.tsx View on Github external
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
    })
  }
github bitnami-labs / cabin / src / utils / SnackbarUtils.js View on Github external
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,
    });
  }

react-native-snackbar

Material Design "Snackbar" component for Android and iOS.

MIT
Latest version published 3 months ago

Package Health Score

75 / 100
Full package analysis