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

react-native-hook-notification

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-hook-notification

Add notifications in your React Native app. Types: success, error, warning, info, default or custom.

  • 2.2.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

React Native Hook Notification

Add notifications in your React Native app. Types: success, error, warning, info, default or custom.

Demo
  • Compatible with Reanimated v2.
  • Compatible with Expo.
  • Written in TypeScript.

Install

npm install react-native-hook-notification

or

yarn add react-native-hook-notification
Dependencies​

This library needs these dependencies to be installed in your project before you can use it:

npm install react-native-reanimated react-native-gesture-handler

or

yarn add react-native-reanimated react-native-gesture-handler

ℹ️ INFO

React Native Gesture Handler needs extra steps to finalize its installation, please follow their installation instructions.

React Native Reanimated v2 needs extra steps to finalize its installation, please follow their installation instructions.

Usage

  • In the application index file:
import React from 'react';
import { NotificationContainer } from 'react-native-hook-notification';

import { Component } from './component/Component';

export default function App() {
  return (
    <>
      <Component />
      <NotificationContainer />
    </>
  );
}
  • In the component:
import React from 'react';
import { TouchableOpacity, Text } from 'react-native';
import { useNotification } from 'react-native-hook-notification';

export default function Component() {
  const notification = useNotification();

  return (
    <TouchableOpacity
      onPress={() =>
        notification.success({
          text: 'Notification test',
        })
      }
    >
      <Text>Dispatch</Text>
    </TouchableOpacity>
  );
}

Props

PropertyTypeRequiredDefaultDescription
textstringyesNotification text
titlestringnoNotification title
positiontop-right | top-center | top-left | bottom-right | bottom-center | bottom-leftnotop-rightNotification position
themecolored | light | darknocoloredNotification theme
transitionbounce | flip | fade | slide | zoomnobounceNotification transition
delaynumberno5000Notification delay in milliseconds
showButtonClosebooleannofalseShow or hide close button
autoClosebooleannotrueAutomatic closing of the notification after the delay ends
pauseOnPressbooleannotrueAuto close pause on hover
closeOnPressbooleannofalseClose on press
onPress() => voidnoCalled on Notification press
draggablebooleannotrueEnable or disable drag
dragDirectionx | ynoyDrag direction
iconReact.FunctionComponentElementnoRender icon on left side. Obs.: Dimensions: 24x24
titleMaxLinesnumberno1Maximum number of lines for title
textMaxLinesnumberno2Maximum number of lines for text
xOffsetnumberno16Offset from the X axis of the screen (in px)
customStyle{ container?: StyleProp<ViewStyle>; title?: StyleProp<TextStyle>; text?: StyleProp<TextStyle>; icon?: StyleProp<ViewStyle>; button?: StyleProp<ViewStyle>;buttonText?: StyleProp<TextStyle>;}noStyles for custom notificaion type

License

License

Developed by: André Coelho

Keywords

FAQs

Package last updated on 17 Oct 2022

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