npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-alert-notification

v0.4.2

Published

Toast notification and dialog box notification for react native

Downloads

7,646

Readme

react-native-alert-notification

Example Dialog Box

| Theme Light | Theme Dark | | :------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------------: | | | |

Example Toast Notification

| Theme Light | Theme Dark | | :----------------------------------------------------------------------------------------------------------------------------------------------------------------: | :--------------------------------------------------------------------------------------------------------------------------------------------------------------: | | | |

Installation

- Installing:

yarn add react-native-alert-notification

- Installing dependencies:

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

pod install
  • For Expo project:
expo install react-native-safe-area-context

Usage

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

<AlertNotificationRoot>
  <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>
</AlertNotificationRoot>;

Documentation:

Root Component

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

| Name | Description | Require | Default | Type | | ------------ | -------------------------------------------- | ------- | ------- | --------------------------------------------------------------------------------------------------- | | theme | select theme light dark (by default is auto) | | auto | 'light','dark' | | colors | custom colors | | | [IColors, IColors] | | dialogConfig | config dialog box global | | | {closeOnOverlayTap:bool, autoClose:bool / number} | | toastConfig | config toast global | | | {autoClose:bool / number, titleStyle?: StyleProp , textBodyStyle?: StyleProp} |

type IProps = {
  dialogConfig?: Pick<IConfigDialog, 'closeOnOverlayTap' | 'autoClose'>;
  toastConfig?: Pick<IConfigToast, 'autoClose' | 'titleStyle' | 'textBodyStyle'>;
  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

| Name | Description | Require | Default | Type | | ----------------- | -------------------------------------------------- | ------- | ------- | ------------------------------ | | title | The title text | | | String | | type | Defines the type ("Success", "Warning" or "Error") | true | | "SUCCESS", "DANGER", "WARNING" | | textBody | The text body | | | String | | button | name button (for hide button: undefined) | | | String | | autoClose | Defines time auto close dialog box in ms | | face | bool / number | | closeOnOverlayTap | allow close if click in overlay | | true | bool | | onPressButton | (if not declared and isset button action is close) | | String | () => void | | onShow | action after end animation open | | | () => void | | onHide | action 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

| Name | Description | Require | Default | Type | | --------- | -------------------------------------------------- | ------- | ------- | ------------------------------ | | title | The title text | | | String | | type | Defines the type ("Success", "Warning" or "Error") | | | "SUCCESS", "DANGER", "WARNING" | | textBody | The text body | | | String | | autoClose | Defines time auto close dialog box in ms | | 5000 | bool / number | | onPress | action click in card | | | bool | | onShow | event after end animation open | | | () => void | | onHide | event after end animation close | | | () => void |

type IConfig = {
  type?: ALERT_TYPE;
  title?: string;
  textBody?: string;
  autoClose?: number | boolean;
  titleStyle?: StyleProp<TextStyle>;
  textBodyStyle?: StyleProp<TextStyle>;
  onPress?: () => void;
  onShow?: () => void;
  onHide?: () => void;
};

For Close popup

// For Dialog Box
Dialog.hide();

// For Toast Notification
Toast.hide();

Author

Rodolphe Jerez | https://codingbyjerez.com

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

License

MIT