Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-notifier

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-notifier

Fast and simple in-app notifications for React Native

  • 0.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.5K
decreased by-23.25%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-notifier

Fast and simple in-app notifications for React Native

Requirements

This library uses react-native-gesture-handler, perfect library for swipes and other gesture events.

If you are using react-navigation then you already have it. If you don't, check Getting Stated guide: https://software-mansion.github.io/react-native-gesture-handler/docs/getting-started.html

Installation

yarn add react-native-notifier

Or

npm install --save react-native-notifier

Usage

Wrap your app with NotifierWrapper

import { NotifierWrapper } from 'react-native-notifier';

const App = () => (
  <NotifierWrapper>
    <Navigation />
  </NotifierWrapper>
);

Or add NotifierRoot at end of your App.js component. Note that NotifierRoot should the last component to display notifications correctly

import { NotifierRoot } from 'react-native-notifier';

const App = () => (
  <>
    <Navigation />
    <NotifierRoot />
  </>
);

Then call Notifier.showNotification() anywhere in code

import { Notifier, Easing } from 'react-native-notifier';

Notifier.showNotification({
  title: 'John Doe',
  description: 'Hello! Can you help me with notifications?',
  duration: 0,
  showAnimationDuration: 800,
  showEasing: Easing.bounce,
  onHide: () => console.log('onHide'),
  onPress: () => console.log('Press'),
  hideOnPress: false,
});

Notifier.showNotification params

NameTypeDefaultDescription
titleStringnullTitle of notification
descriptionStringnullDescription of notification
swipeEnabledBooleantrueCan notification be swiped-out
durationNumber3000Time after notification will disappear
ComponentComponentMainComponentYour custom component of notification body
animationDurationNumber300How fast notification will appear/disappear
showAnimationDurationNumberanimationDuration || 300How fast notification will appear.
hideAnimationDurationNumberanimationDuration || 300How fast notification will disappear.
easingEasingnullAnimation easing. Details: https://reactnative.dev/docs/easing
showEasingEasingeasing || nullShow Animation easing.
hideEasingEasingeasing || nullHide Animation easing.
onHideFunctionnullFunction called when notification started hiding
onPressFunctionnullFunction called when user press on notification
hideOnPressBooleantrueShould notification hide when user press on it
swipePixelsToCloseNumber20How many pixels user should swipe-up notification to dismiss it
swipeEasingEasingnullAnimation easing after user finished swiping
swipeAnimationDurationNumber200How fast should be animation after user finished swiping

License

MIT

Keywords

FAQs

Package last updated on 22 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc