https://github.com/qeepsake/react-native-custom-alerts
Setup custom alerts and invoke them anywhere in your application (written in TypeScript!)
https://github.com/qeepsake/react-native-custom-alerts
alerts custom i18n react react-native
Last synced: about 1 year ago
JSON representation
Setup custom alerts and invoke them anywhere in your application (written in TypeScript!)
- Host: GitHub
- URL: https://github.com/qeepsake/react-native-custom-alerts
- Owner: Qeepsake
- Created: 2020-08-19T13:05:30.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-05T16:51:38.000Z (almost 5 years ago)
- Last Synced: 2025-04-11T04:48:03.499Z (about 1 year ago)
- Topics: alerts, custom, i18n, react, react-native
- Language: JavaScript
- Homepage:
- Size: 390 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Native Custom Alerts
This library provides the ability to define alerts which can be used all across an application. Instead of having a separate function for all these alerts, we can define them when the application starts and easily use them wherever we need them.
## Install
```sh
npm install @qeepsake/react-native-custom-alerts
```
or
```sh
yarn add @qeepsake/react-native-custom-alerts
```
## Usage
You need to register you alerts when the application starts.
```js
import {CustomAlert} from 'react-native-custom-alerts';
CustomAlert.setup('my-custom-alert', 'Title', 'Message', buttons, options);
CustomAlert.setup('my-second-alert', 'Title', 'Message', buttons, options);
```
Now, you can place the alert you want to show elsewhere in your application.
```js
import {CustomAlert} from 'react-native-custom-alerts';
CustomAlert.alert('my-second-alert');
```
## Methods
### setup()
```js
static setup(name, title, message?, buttons?, options?)
```
### alert()
```js
static alert(name)
```
## License
This project is licensed under the MIT License