# react-native-modal-notifier

> react-native-modal-notifier is a third party in-app notification package! It provides modal notification popup.

Latest version **1.0.7** (published 2022-05-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-modal-notifier
pnpm add react-native-modal-notifier
yarn add react-native-modal-notifier
bun add react-native-modal-notifier
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.7 |
| Published | 2022-05-24 |
| First published | 2022-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | crazycoder-io |
| Maintainers | crazycoder-io |
| Keywords | react-native-modal-notifier, notification, react-native-notification, react-native-modal, react-native-in-app-notification, react-native-modal-notifier |

## Links

- npm: https://www.npmjs.com/package/react-native-modal-notifier
- Repository: https://github.com/crazycoder-io/react-native-modal-notifier
- Homepage: https://github.com/crazycoder-io/react-native-modal-notifier#readme
- Issues: https://github.com/crazycoder-io/react-native-modal-notifier/issues
- npm.io page: https://npm.io/package/react-native-modal-notifier

## Alternatives

- [react-native-root-siblings](https://npm.io/package/react-native-root-siblings.md) — 102.9K weekly downloads
- [post-robot](https://npm.io/package/post-robot.md) — 93.7K weekly downloads
- [@praxisui/dialog](https://npm.io/package/@praxisui/dialog.md) — 2.0K weekly downloads
- [easy-toggle-state](https://npm.io/package/easy-toggle-state.md) — 350 weekly downloads
- [ngx-lightbox-evp](https://npm.io/package/ngx-lightbox-evp.md) — 19 weekly downloads

## Recent versions

- 1.0.7 (latest) — 2022-05-24
- 1.0.6 — 2022-05-09
- 1.0.5 — 2022-05-09
- 1.0.4 — 2022-05-07
- 1.0.3 — 2022-05-05
- 1.0.2 — 2022-05-03
- 1.0.1 — 2022-05-02
- 1.0.0 — 2022-05-02

## README

# React Native Modal Notifier
[![npm](https://badgen.net/npm/v/react-native-modal-notifier)](https://www.npmjs.com/package/react-native-modal-notifier)
[![dw](https://badgen.net/npm/dw/react-native-modal-notifier)](https://www.npmjs.com/package/react-native-modal-notifier)
![platforms: ios, android](https://img.shields.io/badge/platform-ios%2C%20android%2C%20expo-orange)
[![license MIT](https://img.shields.io/badge/license-MIT-brightgreen)](https://github.com/crazycoder-io/react-native-modal-notifier/blob/master/LICENSE)



**react-native-modal-notifier** is a third party in-app notification notifier package! It provides modal notification popup. And reachable from any screen or component after the wrap the application with container.
There are more than one usage example;
1. Can be triggered by `useEffect` function
2. Can be triggered by user action
3. Can be triggered by api service data

<p align="center">
    <img src="src/assets/rnmodalnotifier.gif" alt="drawing" width="200" />
</p>

## Installation
```sh
yarn add react-native-modal-notifier
```
Or
```sh
npm install --save react-native-modal-notifier
```

## Usage

Wrap your app with `NotifierContainer`
```js
import { NotifierContainer } from 'react-native-modal-notifier';
const App = () => (
  <NotifierContainer>
    <HomeScreen />
  </NotifierContainer>
);
```
Then import `useNotifier` anywhere in your code/screen/components
```js
import { useNotifier } from 'react-native-modal-notifier';

const HomeScreen = () => {
    const notifier = useNotifier();

    useEffect(() => {
        alert && notifier({
            title: alert.title,
            message: alert.message
        });
    }, [alert]);

    return (
    <TouchableHighlight
      onPress={() =>
        notifier({
          title: 'New Notification',
          message:
            'New Notification',
        })
      }>
      <Text>Set Notification</Text>
    </TouchableHighlight>
  );
};
```

## Props of useNotifier

| Name | Description | Type  | Default  |
|-----------------|:-------------|:---------------:|---------------:|
| title | Title of the message | string | `null` |
| message | The message of the content | string | `null` |
| headerShown | Header visibility option | boolean | `true` |
| primaryButtonText | The text in the primary button content | string | `undefined` |
| primaryButtonAction | The primary button action | func | `undefined` |
| primaryButtonColor | The background color of the primary button | string | `#3a86ff` |
| primaryButtonPosition | The position of the primary button in the notifier | `center` or `right` or `left` | `center` |
| type | The type of modal notifier | `default` or `info` or `warning` or `error` | `default` |
| childComponent | The child component to be rendered within the modal component | `JSX.Element` | `undefined` |
| contentImage | The image uri or address to be rendered within the modal | `ImageSourcePropType` | `undefined` |
| contentImageRadius | The image radius controller | boolean | `false` |
| contentImageSize | The size of the content image | `small` or `middle` or `large` | `middle` |
| contentImageType | The image type of content | `square` or `rectangle` | `square` |
| autoCloseDelay | The timer of the auto close the notifier as millisecond | `number` | null |

---
_Source: https://npm.io/package/react-native-modal-notifier · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
