🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

react-native-alert-notification

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-alert-notification

Toast notification and dialog box notification for react native

0.1.3
Source
npm
Version published
Weekly downloads
2.7K
-20.24%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-alert-notification

Example Dialog Box

Theme LightTheme Dark
Example OneExample TwoExample Three

Installation

###- Installing dependencies:

  • For Native project:
yarn add react-native-safe-area-context
pod install

###- Installing:

yarn add react-native-safe-area-context

Usage

import { ALERT_TYPE, Dialog, Root, Toast } from 'react-native-alert-notification';


<Root>
  <View>

    // dialog box
    <Button
      title={'dialog box'}
      onPress={ () => Dialog.show({
        type: ALERT_TYPE.SUCCESS,
        title: 'Success',
        textBody:'Congrats! this is dialog box success',
        button:'close'
      })}
    />

    // toast notification
    <Button
      title={'toast notification'}
      onPress={ () => Toast.show({
        type: ALERT_TYPE.SUCCESS,
        title: 'Success',
        textBody:'Congrats! this is toast notification success',
      })}
    />

  </View>
</Root>

Documentation:

Root Component

A React node that will be most likely wrapping your whole app.

NameDescriptionRequireDefaultType
themeselect theme light dark (by default is auto)auto'light','dark'
colorsDefines the type ("Success", "Warning" or "Error")[IColors, IColors]
dialogConfigThe text body{closeOnOverlayTap:bool, autoClose:bool / number}
toastConfigname button (for hide button: undefined){autoClose:bool / number}
type IProps = {
  dialogConfig?: Pick<IConfigDialog, 'closeOnOverlayTap' | 'autoClose'>;
  toastConfig?: Pick<IConfigToast, 'autoClose'>;
  theme?: 'light' | 'dark';
  colors?: [IColors, IColors] /** ['light_colors' , 'dark_colors'] */;
};
type IColors = {
  label: string;
  card: string;
  overlay: string;
  success: string;
  danger: string;
  warning: string;
};

Dialog Box Component

NameDescriptionRequireDefaultType
titleThe title texttrueString
typeDefines the type ("Success", "Warning" or "Error")true"SUCCESS", "DANGER", "WARNING"
textBodyThe text bodytrueString
buttonname button (for hide button: undefined)String
autoCloseDefines time auto close dialog box in msfacebool / number
closeOnOverlayTapallow close if click in overlaytruebool
onPressButton(if not declared and isset button action is close)String() => void
onShowaction after end animation open() => void
onHideaction after end animation close() => void
type IConfig = {
  type: ALERT_TYPE;
  title: string;
  textBody: string;
  button?: string;
  autoClose?: number | boolean;
  closeOnOverlayTap?: boolean;
  onPressButton?: () => void;
  onShow?: () => void;
  onHide?: () => void;
};

Toast Notification Component

NameDescriptionRequireDefaultType
titleThe title texttrueString
typeDefines the type ("Success", "Warning" or "Error")"SUCCESS", "DANGER", "WARNING"
textBodyThe text bodytrueString
autoCloseDefines time auto close dialog box in ms5000bool / number
onPressaction click in cardbool
onLongPressaction long click in card() => void
onShowevent after end animation open() => void
onHideevent after end animation close() => void
type IConfig = {
  type?: ALERT_TYPE;
  title: string;
  textBody: string;
  autoClose?: number | boolean;
  onPress?: () => void;
  onLongPress?: () => void;
  onShow?: () => void;
  onHide?: () => void;
};

Author

Rodolphe Jerez | https://codingbyjerez.com

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

react-native

FAQs

Package last updated on 16 May 2021

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