{"id":18331980,"url":"https://github.com/mrousavy/react-native-notification-badge","last_synced_at":"2025-04-06T03:33:29.622Z","repository":{"id":46553877,"uuid":"282436870","full_name":"mrousavy/react-native-notification-badge","owner":"mrousavy","description":"🔴 A notification badge count manager for React Native","archived":false,"fork":false,"pushed_at":"2021-10-05T22:40:20.000Z","size":372,"stargazers_count":55,"open_issues_count":4,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-18T13:13:29.649Z","etag":null,"topics":["badge","library","manager","native-module","notification","notifications","react","react-native"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrousavy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":"mrousavy","ko_fi":"mrousavy","custom":["https://paypal.me/mrousavy"]}},"created_at":"2020-07-25T12:12:09.000Z","updated_at":"2024-11-20T08:07:29.000Z","dependencies_parsed_at":"2022-09-10T20:31:39.811Z","dependency_job_id":null,"html_url":"https://github.com/mrousavy/react-native-notification-badge","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2Freact-native-notification-badge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2Freact-native-notification-badge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2Freact-native-notification-badge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrousavy%2Freact-native-notification-badge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrousavy","download_url":"https://codeload.github.com/mrousavy/react-native-notification-badge/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430838,"owners_count":20937873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["badge","library","manager","native-module","notification","notifications","react","react-native"],"created_at":"2024-11-05T19:36:41.013Z","updated_at":"2025-04-06T03:33:28.945Z","avatar_url":"https://github.com/mrousavy.png","language":"Swift","funding_links":["https://github.com/sponsors/mrousavy","https://ko-fi.com/mrousavy","https://paypal.me/mrousavy","https://ko-fi.com/F1F8CLXG'"],"categories":[],"sub_categories":[],"readme":"# react-native-notification-badge\n\n\u003e For when you don't want to use a fully featured notification manager\n\nA very simple notification badge count manager for React Native that just works.\n\n[![react-native-notification-badge](https://badge.fury.io/js/react-native-notification-badge.svg)](https://badge.fury.io/js/react-native-notification-badge)\n[![GitHub stars](https://img.shields.io/github/stars/mrousavy/react-native-notification-badge.svg?style=social\u0026label=Star\u0026maxAge=259000)](https://github.com/mrousavy/react-native-notification-badge/stargazers/)\n[![GitHub followers](https://img.shields.io/github/followers/mrousavy.svg?style=social\u0026label=Follow\u0026maxAge=259000)](https://github.com/mrousavy?tab=followers)\n\n\u003ca href='https://ko-fi.com/F1F8CLXG' target='_blank'\u003e\u003cimg height='36' style='border:0px;height:36px;' src='https://az743702.vo.msecnd.net/cdn/kofi2.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' /\u003e\u003c/a\u003e\n\n## API\n\n### `getBadgeCount`\n\n**Asynchronously returns the current Badge count.**\n\nNote: 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](https://github.com/react-native-community/react-native-permissions)\n\n```ts\nconst badgeCount = await getBadgeCount()\n```\n\n### `getBadgeCountSync`\n\nSame as [`getBadgeCount`](#getbadgecount), but synchronously.\n\n```ts\nconst badgeCount = getBadgeCountSync()\n```\n\n### `setBadgeCount`\n\n**Asynchronously sets the Badge count.**\n\nNote: 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](https://github.com/react-native-community/react-native-permissions)\n\n```ts\nawait setBadgeCount(2)\n```\n\n### `getNotificationBadgeSetting`\n\n**Asynchronously gets the current state of the \"Notification Badge\" permission setting.**\n\nPossible values are: `'enabled' | 'disabled' | 'notSupported' | 'unknown'`\n\n```ts\nconst permission = await getNotificationBadgeSetting()\nif (permission === 'enabled') {\n  await setBadgeCount(5)\n} else {\n  console.log(\"Badge permission has not yet been granted. I'll ask the user later\")\n}\n```\n\n### `requestNotificationPermissions`\n\n**Asynchronously request the user to grant the specified permissions.**\n\nPossible parameter values are: `['badge' | 'alert' | 'sound' | 'carPlay' | 'criticalAlert' | 'providesAppNotificationSettings' | 'provisional' | 'announcement']`\n\n```ts\nconst granted = await requestNotificationPermissions(['badge', 'alert', 'sound'])\n```\n\n### `removeNotificationsWithThreadId`\n\n**Remove all notification with the given Thread ID from the User's Notification Center.**\n\n\u003e The Thread ID is a property in the APNS payload which can be used to group notifications in **iOS 10.0** or higher.\n\nReturns the count of notifications that were removed.\n\n```ts\nconst removed = await removeNotificationsWithThreadId('group-chat-2')\n```\n\n\n## Other\n\nCheck out my other react-native libraries:\n\n* [react-native-blurhash](https://github.com/mrousavy/react-native-blurhash): 🖼️ Give your users the loading experience they want.\n* [react-native-google-nearby-messages](https://github.com/mrousavy/react-native-google-nearby-messages): 📲 Communicate with nearby devices using Bluetooth, BLE, WiFi and near-ultrasonic audio. Broadcast and receive small payloads (like strings) using the easy-to-use React Native API!\n* [react-native-sectioned-slider](https://github.com/mrousavy/react-native-sectioned-slider): An iOS 11 Control Center inspired Slider for React Native\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrousavy%2Freact-native-notification-badge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrousavy%2Freact-native-notification-badge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrousavy%2Freact-native-notification-badge/lists"}