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.

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 });
  };