@emanon_/react-native-notification

1.0.6 • Public • Published

notification

Getting started

$ npm install @emanon_/react-native-notification --save

or

$ yarn add @emanon_/react-native-notification

Automatic installation

please Use react-native 0.60+, it will be autolink.

iOS

  1. $ cd ios
  2. $ pod install

Android

Add the NotificationsPackage to your android/app/src/main/java/com/[app name]/MainApplication.java:

import com.facebook.react.ReactApplication;
import com.emanon.notifications.NotificationsPackage;// <-- Add this line

public class MainApplication extends Application implements ReactApplication {

  // ...

    @Override
    protected List<ReactPackage> getPackages() {
      @SuppressWarnings("UnnecessaryLocalVariable")
      List<ReactPackage> packages = new PackageList(this).getPackages();
      // Packages that cannot be autolinked yet can be added manually here, for example:
      // packages.add(new MyReactNativePackage());
      packages.add(new NotificationsPackage());	// <-- Add this line
      return packages;
    }

	// ...

}

Manual installation

Manual installation is not recommend, please Use react-native 0.60+.

Usage

Most usage is like notifications in react-native-firebase

import { NotificationApp } from '@emanon_/react-native-notification';

// TODO: What to do with the module?
NotificationApp
      .notifications()
      .hasPermission()
      .then(enabled => {
        if (enabled) {
          // user has permissions
        } else {
          // user doesn't have permission
        }
			});
			

NotificationApp
	.notifications()
	.requestPermission()
	.then(() => {
		// User has authorised
	})
	.catch(error => {
		// User has rejected permissions
	});
			

TODO

  • APNS
  • Firebase Cloude Message & GCM Message
  • CN Push

Readme

Keywords

Package Sidebar

Install

npm i @emanon_/react-native-notification

Weekly Downloads

1

Version

1.0.6

License

MIT

Unpacked Size

246 kB

Total Files

59

Last publish

Collaborators

  • jebai0521