npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kode-stack/notification-react-native

v1.1.5

Published

Cross-platform Push Notification SDK for React Native (Android & iOS) with OneSignal-like API

Downloads

531

Readme

@kode-stack/notification-react-native

Official React Native SDK for the TL Notification Service (supports Android & iOS with OneSignal-like simplicity).

🚀 Key Features

  • Cross-Platform: Works identically on Android and iOS in React Native CLI.
  • OneSignal-Like API: initialize(), login(), logout(), setTags().
  • Auto Device Upsert: Captures OS, device model, timezone, and language.
  • Auto Token Refresh: Listens to FCM/APNs token rotation and syncs to backend.
  • Analytics & Tracking: Automatically reports DELIVERED and CLICKED events.

📦 Installation in React Native CLI

In your React Native CLI project:

# Required peer dependencies
npm install @react-native-firebase/app @react-native-firebase/messaging @react-native-async-storage/async-storage

# If using as local package:
npm install ../path/to/tl-notification-service/sdks/react-native
# OR just copy `TLNotification.ts` directly into your `src/services/` folder!

For iOS:

cd ios && pod install && cd ..

🛠️ Setup in React Native

1. In index.js or App.tsx (App Launch)

import React, { useEffect } from 'react';
import TLNotification from '@tl/notification-react-native';

const App = () => {
  useEffect(() => {
    // 1. Initialize SDK
    TLNotification.initialize({
      baseUrl: 'http://YOUR_SERVER_IP:8080/v1',
      appKey: 'tl_app_live_xxxxxxxxxxxxxxxx',
    });

    // 2. Listen for notification clicks (navigation routing)
    const unsubscribe = TLNotification.onNotificationOpened((notification) => {
      console.log('User tapped push notification:', notification.title);
      // e.g., navigation.navigate('OrderDetail', { id: notification.customData?.orderId });
    });

    return () => unsubscribe();
  }, []);

  return <YourNavigationRoot />;
};

export default App;

2. When the User Logs In:

// Links this device to their user account ID in your database:
await TLNotification.login('user_12345');

3. When the User Logs Out:

// Unlinks the device so they don't receive personal notifications after logout:
await TLNotification.logout();

4. Updating User Tags (for Segments):

await TLNotification.setTags({
  vip: true,
  country: 'KH',
  tier: 'Gold',
});

📱 Background Push Handling (Android & iOS)

In your React Native index.js:

import { AppRegistry } from 'react-native';
import messaging from '@react-native-firebase/messaging';
import TLNotification from '@tl/notification-react-native';
import App from './App';
import { name as appName } from './app.json';

// Handle background notifications
messaging().setBackgroundMessageHandler(async (remoteMessage) => {
  const notificationId = remoteMessage.data?.notificationId;
  if (notificationId) {
    await TLNotification.trackEvent(notificationId, 'DELIVERED');
  }
});

AppRegistry.registerComponent(appName, () => App);