Socket
Socket
Sign inDemoInstall

react-native-notification-badge

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-notification-badge

A notification badge count manager for React Native


Version published
Weekly downloads
836
decreased by-44.82%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-notification-badge

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.

react-native-notification-badge GitHub stars GitHub followers

Buy Me a Coffee at ko-fi.com

API

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'])

Other

Check out my other react-native libraries:

Keywords

FAQs

Package last updated on 25 Jul 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc