All Projects → robcalcroft → React Native In App Notification

robcalcroft / React Native In App Notification

Licence: mit
🔔 Customisable in-app notification component for React Native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native In App Notification

SpaceView
No description or website provided.
Stars: ✭ 58 (-71.84%)
Mutual labels:  notifications, dropdown
Budgie Desktop
I Tawt I Taw A Purdy Desktop
Stars: ✭ 2,374 (+1052.43%)
Mutual labels:  notifications
Angular Notifier
A well designed, fully animated, highly customizable, and easy-to-use notification library for your Angular application.
Stars: ✭ 175 (-15.05%)
Mutual labels:  notifications
Python Notifyall
A library which can be used for all types of notifications like SMS, Mail, Push.
Stars: ✭ 185 (-10.19%)
Mutual labels:  notifications
Googlecontactseventsnotifier
Receive automatic email notifications before your Google Contacts birthday and other events!
Stars: ✭ 177 (-14.08%)
Mutual labels:  notifications
Ng2 Notifications
Angular 2 Component for Native Push Notifications [Looking for New Maintainers]
Stars: ✭ 192 (-6.8%)
Mutual labels:  notifications
Amplify Cli
The AWS Amplify CLI is a toolchain for simplifying serverless web and mobile development.
Stars: ✭ 2,399 (+1064.56%)
Mutual labels:  notifications
Uptime Monitor App
A PHP application to monitor uptime and ssl certificates
Stars: ✭ 205 (-0.49%)
Mutual labels:  notifications
Azdropdownmenu
A simple dropdown menu component for iPhone
Stars: ✭ 198 (-3.88%)
Mutual labels:  dropdown
Dllocalnotifications
💬 Easily create Local Notifications in swift - Wrapper of UserNotifications Framework
Stars: ✭ 182 (-11.65%)
Mutual labels:  notifications
Vue Treeselect
A multi-select component with nested options support for Vue.js
Stars: ✭ 2,347 (+1039.32%)
Mutual labels:  dropdown
Shoutrrr
Notification library for gophers and their furry friends.
Stars: ✭ 177 (-14.08%)
Mutual labels:  notifications
Hawkeye
A useful app for GitHub Notifications
Stars: ✭ 193 (-6.31%)
Mutual labels:  notifications
React Notify Toast
Toast notifications for React.js
Stars: ✭ 176 (-14.56%)
Mutual labels:  notifications
Ng Multiselect Dropdown
Multiple Select Dropdown Component
Stars: ✭ 199 (-3.4%)
Mutual labels:  dropdown
Bdialog
Extend the Bootstrap Modal features, making dialog more functions and easier to use, dialog type including modal, alert, mask and toast types
Stars: ✭ 174 (-15.53%)
Mutual labels:  notifications
Flutter smart select
SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.
Stars: ✭ 179 (-13.11%)
Mutual labels:  dropdown
Sweetalert2
A beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
Stars: ✭ 13,929 (+6661.65%)
Mutual labels:  notifications
Electron Windows Notifications
⚡️ Send native Windows WinRT notifications from Electron
Stars: ✭ 206 (+0%)
Mutual labels:  notifications
Notify Send.sh
drop-in replacement for notify-send with more features
Stars: ✭ 200 (-2.91%)
Mutual labels:  notifications

react-native-in-app-notification npm version

🔔 Customisable in-app notification component for React Native

Contents

  1. UI
  2. Install
  3. Versions
  4. Props
  5. Usage

UI

The basic look of react-native-in-app-notification:

A GIF showing what react-native-in-app-notification can do

What you can make react-native-in-app-notification do with a customised component:

A GIF showing what react-native-in-app-notification can do

Install

yarn add react-native-in-app-notification

OR

npm install react-native-in-app-notification --save

Android

For Android you need to add the VIBRATE permission to your app AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="your.app.package.name">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

    <!-- Required by react-native-in-app-notification -->
    <uses-permission android:name="android.permission.VIBRATE" />

    ...
</manifest>

Versions

version RN
>=3.0.0 >= 0.54.0
<3.0.0 >= 0.43.4

Props

Prop Name Prop Description Data Type Required Default
closeInterval How long the notification stays visible Number No 4000
openCloseDuration The length of the open / close animation Number No 200
height The height of the Notification component Number No 80
backgroundColour The background colour of the Notification component String No white
iconApp App Icon ImageSourcePropType No null
notificationBodyComponent See below about NotificationBody React Node or Function Recommended ./DefaultNotificationBody

NotificationBody

The notification body is what is rendered inside the main Notification component and gives you the ability to customise how the notification looks. You can use the default notification body component in ./DefaultNotificationBody.js as inspiration and guidance.

Your notificationBodyComponent component is given five props:

Prop Name Prop Description Data Type Default
title The title passed to NotificationRef.show String ''
message The message passed to NotificationRef.show String ''
onPress The callback passed to NotificationRef.show Function null
icon Icon for notification passed to NotificationRef.show ImageSourcePropType null
vibrate Vibrate on show notification passed to NotificationRef.show Boolean true
additionalProps Any additional props passed to NotificationBodyComponent Object null

Usage

Adding react-native-in-app-notification is simple; Just wrap you main App component with the InAppNotificationProvider component exported from this module.

import { InAppNotificationProvider } from 'react-native-in-app-notification';

import App from './App.js';

class AppWithNotifications extends Component {
  render() {
    return (
      <InAppNotificationProvider>
        <App />
      </InAppNotificationProvider>
    );
  }
}

When you want to show the notification, just wrap the component which needs to display a notification with the withInAppNotification HOC and call the .showNotification methods from its props.

.showNotification can take four arguments (all of which are optional):

  • title
  • message
  • onPress
  • additionalProps

N.B: you should probably include at least one of title or message!

onPress doesn't need to be used for passive notifications and you can use onClose in your NotificationBody component to allow your users to close the notification.

additionalProps can be used to pass arbitory props to NotificationBody component. Can be accessed in NotificationBody component via props.additionalProps.

import React, { Component } from 'react';
import { View, Text, TouchableHighlight } from 'react-native';
import { withInAppNotification } from 'react-native-in-app-notification';

class MyApp extends Component {
  render() {
    return (
      <View>
        <Text>This is my app</Text>
        <TouchableHighlight
          onPress={() => {
            this.props.showNotification({
              title: 'You pressed it!',
              message: 'The notification has been triggered',
              onPress: () => Alert.alert('Alert', 'You clicked the notification!'),
              additionalProps: { type: 'error' },
            });
          }}
        >
          <Text>Click me to trigger a notification</Text>
        </TouchableHighlight>
      </View>
    );
  }
}

export default withInAppNotification(MyApp);
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].