@react-native-hero/badge

0.0.1 • Public • Published

@react-native-hero/badge

Getting started

Install the library using either Yarn:

yarn add @react-native-hero/badge

or npm:

npm install --save @react-native-hero/badge

Link

  • React Native v0.60+

For iOS, use cocoapods to link the package.

run the following command:

$ cd ios && pod install

For 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/badge

Example

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

Readme

Keywords

Package Sidebar

Install

npm i @react-native-hero/badge

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

15.2 kB

Total Files

11

Last publish

Collaborators

  • musicode