How to use the react-native-notifications.checkPermissions function in react-native-notifications

To help you get started, we’ve selected a few react-native-notifications 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 demokratie-live / democracy-client / src / screens / Notifications / index.js View on Github external
componentDidMount() {
    AppState.addEventListener('change', this.handleAppStateChange);

    if (Platform.OS === 'ios') {
      NotificationsIOS.checkPermissions().then(currentPermissions => {
        this.setState({
          notificationsAllowed:
            !!currentPermissions.badge || !!currentPermissions.sound || !!currentPermissions.alert,
        });
      });
    } else {
      // TODO: Check android permissions
    }
  }
github demokratie-live / democracy-client / src / screens / Notifications / index.js View on Github external
handleAppStateChange = nextAppState => {
    if (this.state.appState.match(/inactive|background/) && nextAppState === 'active') {
      if (Platform.OS === 'ios') {
        NotificationsIOS.checkPermissions().then(currentPermissions => {
          this.setState({
            notificationsAllowed:
              !!currentPermissions.badge ||
              !!currentPermissions.sound ||
              !!currentPermissions.alert,
          });
        });
      }
    }
    this.setState({ appState: nextAppState });
  };

react-native-notifications

Advanced Push Notifications (Silent, interactive notifications) for iOS & Android

MIT
Latest version published 8 months ago

Package Health Score

72 / 100
Full package analysis