How to use the @react-native-community/push-notification-ios.setApplicationIconBadgeNumber function in @react-native-community/push-notification-ios

To help you get started, we’ve selected a few @react-native-community/push-notification-ios 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 rastapasta / foodsharing / src / sagas / conversations.tsx View on Github external
if (action.payload.type === MessageType.RECEIVED && scene === 'conversation' && sceneId == action.payload.cid)
        yield put({type: MESSAGE_READ, payload: action.payload.cid})
    }

    // Get and count the number of unread conversations and bells
    const conversations = yield select(state => state.conversations)
        , unreadConversations = countUnread(conversations)

        , bells = yield select(state => state.bells)
        , unreadBells = bells.reduce((sum, bell: Bell) => sum + (bell.isRead ? 0 : 1), 0)
        , unread = unreadConversations + unreadBells

    // Set the badge count depending on the relevant bridge
    yield call(
      Platform.OS === 'ios' ?
        PushNotificationIOS.setApplicationIconBadgeNumber :
        AndroidBadge.setBadge,
      unread
    )
  }
}