Security News
New axobject-query Maintainer Faces Backlash Over Controversial Decision to Support Legacy Node.js Versions
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
react-native-notification-badge
Advanced tools
Readme
For when you don't want to use a fully featured notification manager
A very simple notification badge count manager for React Native that just works.
getBadgeCount
Asynchronously returns the current Badge count.
Note: If no notification permissions have been granted yet, this will also ask the user for notification permissions (only [.badge]
), so request permissions before calling this using a library like react-native-permissions
const badgeCount = await getBadgeCount()
getBadgeCountSync
Same as getBadgeCount
, but synchronously.
const badgeCount = getBadgeCountSync()
setBadgeCount
Asynchronously sets the Badge count.
Note: If no notification permissions have been granted yet, this will also ask the user for notification permissions (only [.badge]
), so request permissions before calling this using a library like react-native-permissions
await setBadgeCount(2)
getNotificationBadgeSetting
Asynchronously gets the current state of the "Notification Badge" permission setting.
Possible values are: 'enabled' | 'disabled' | 'notSupported' | 'unknown'
const permission = await getNotificationBadgeSetting()
if (permission === 'enabled') {
await setBadgeCount(5)
} else {
console.log("Badge permission has not yet been granted. I'll ask the user later")
}
requestNotificationPermissions
Asynchronously request the user to grant the specified permissions.
Possible parameter values are: ['badge' | 'alert' | 'sound' | 'carPlay' | 'criticalAlert' | 'providesAppNotificationSettings' | 'provisional' | 'announcement']
const granted = await requestNotificationPermissions(['badge', 'alert', 'sound'])
Check out my other react-native libraries:
FAQs
A notification badge count manager for React Native
The npm package react-native-notification-badge receives a total of 1,689 weekly downloads. As such, react-native-notification-badge popularity was classified as popular.
We found that react-native-notification-badge demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A JavaScript library maintainer is under fire after merging a controversial PR to support legacy versions of Node.js.
Security News
Results from the 2023 State of JavaScript Survey highlight key trends, including Vite's dominance, rising TypeScript adoption, and the enduring popularity of React. Discover more insights on developer preferences and technology usage.
Security News
The US Justice Department has penalized two consulting firms $11.3 million for failing to meet cybersecurity requirements on federally funded projects, emphasizing strict enforcement to protect sensitive government data.