🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

react-native-app-notification

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-app-notification

In-app custom notifications for React-Native

latest
Source
npmnpm
Version
1.7.2
Version published
Maintainers
1
Created
Source

react-native-app-notification

A gif showing react-native-app-notification

Content

  • Installation
  • Setup
  • Props
  • Methods

Installation

npm i react-native-app-notification

Setup

Inside of App.tsx

import AppNotification from 'react-native-app-notification'

const App = () => {
  return (
    <View>
      (...)
      <AppNotification />
    </View>
  )
}

Example


// Anywhere in the app
AppNotification.show({
  title: 'New message'
  message: 'Someone sent you a message!',
  onPress: navigateToMessages,
})

// You can inject your own components to extend it further
AppNotification.show({
  title: 'New message'
  message: 'Someone sent you a message!',
  left: <NotificationIcon />,
  right: <ShowButton />,
})

AppNotification Component Props

PropertyTypeOptionalDefaultDescription
animatedbooleantruetrueDetermines if the notification should animate in/out
durationnumbertrue5000Lifetime in MS
renderNotificationfunctiontrue undefinedOverrides notification renderring
maxAmountnumbertrue undefinedSets amount of notifications that can be active at once
alignBottombooleantruefalseRenders the notifications from the bottom
bottomOffsetnumbertruelayout.height * 0.07Bottom offset
topOffsetnumbertruelayout.height * 0.07Top offset
contentContainerStyleStyleProptrue{ marginLeft: 8, width: 85%}Stylesheet for the View renderring all the notifications
containerStyleStyleProptrueSEE SOURCEStylesheet for the notification card
titleStyleStyleProptrueSEE SOURCEStylesheet for the title
messageStyleStyleProptrueSEE SOURCEStylesheet for the messagee
imageStyleStyleProptrueSEE SOURCEStylesheet for the image

Methods

MethodDescriptionProps
show(options)Renders a notificationtitle, message, imageUrl, onPress, panEnabled, left, right (and everything above except for contentContainerStyle)
clear()Clears all notificationsnone

Keywords

notification

FAQs

Package last updated on 11 Oct 2024

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