0.0.1 • Published 6 years ago
@react-native-hero/badge v0.0.1
@react-native-hero/badge
Getting started
Install the library using either Yarn:
yarn add @react-native-hero/badgeor npm:
npm install --save @react-native-hero/badgeLink
- React Native v0.60+
For iOS, use cocoapods to link the package.
run the following command:
$ cd ios && pod installFor android, the package will be linked automatically on build.
- React Native <= 0.59
run the following command to link the package:
$ react-native link @react-native-hero/badgeExample
import {
getBadge,
setBadge,
} from '@react-native-hero/badge'
// set the badge
// make sure you have the notifications permission on ios.
setBadge(1)
// clear the badge
// make sure you have the notifications permission on ios.
setBadge(0)
// read the badge
getBadge().then(data => {
// ios works
// but android can't read the badge, so it is always 0
data.badge
})0.0.1
6 years ago