GithubHelp home page GithubHelp logo

manigandanraamanathan / react-native-push-notification-popup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from carsonwah/react-native-push-notification-popup

0.0 1.0 0.0 38 KB

A <NotificationPopup/> component for presenting your own push notification in react-native app

License: MIT License

JavaScript 100.00%

react-native-push-notification-popup's Introduction

React Native Push Notification Popup

npm version GitHub license Maintenance Ask Me Anything !

iOS Preview Android Preview

Features

  • Support "pan" gesture
  • Support "onPress" gesture feedback
  • Written in pure-JS using official react-native Animation package
    • Which means it supports all Expo/CRNA apps
  • Support iPhone X, XS, Max (yeah that notch)
  • Support Android native "elevation"

Motivations

Blog post

  1. In some apps, you may just want to display reminders to user, without going through those troublesome push notification setups
  2. Expo/CNRA apps cannot display push notification while app is in foreground
  3. Even if you eject, you still need to configure iOS and Android separately with native codes

This package is here to help. Just show your own notification popup to your users!

Installation

yarn add react-native-push-notification-popup  # recommended
npm install react-native-push-notification-popup --save

Usage

Declare Component

Put it in a wrapper component. (Maybe where you handle your incoming push notifications)

import NotificationPopup from 'react-native-push-notification-popup';

// ...

  render() {
    return (
      <View style={styles.container}>
        <NotificationPopup ref={ref => this.popup = ref} />
        <MaybeYourNavigator />
      </View>
    );
  }

Show it!

componentDidMount() {
  this.popup.show({
    onPress: function() {console.log('Pressed')},
    appIconSource: require('./assets/icon.jpg'),
    appTitle: 'Some App',
    timeText: 'Now',
    title: 'Hello World',
    body: 'This is a sample message.\nTesting emoji ๐Ÿ˜€',
  });
}

Props

(Customizing options coming soon)

Methods

.show()

Param Type Default Description
onPress Function null Callback to be called when user press the popup
appIconSource Image source null Icon on the upper left
appTitle String '' Usually your app name, but you can also customize it
timeText String '' Text on the upper right
title String '' Message title
body String '' Message body (support multi-line)

Roadmap

  • Support showing it globally
  • Customizing props: speed, duration, etc
  • Support image on the right-side
  • Android material design style
  • Other types of popup, e.g. without app icon
  • More usage examples
  • Transparent Background
  • Identify peerDependencies on react-native

License

MIT License. ยฉ Carson Wah 2018

react-native-push-notification-popup's People

Contributors

carsonwah avatar zaicevas avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.