react-native-alert-pro
- Super lightweight component
- Smooth animation
- Beautiful
- Use method instead of state
- Work like a Pro
- Customize whatever you like
- Support all orientations
- Support both Android and iOS
iOS | Android |
---|---|
![]() |
![]() |
Installation
npm i react-native-alert-pro --save
or
yarn add react-native-alert-pro
Example
import React Component from "react";import StyleSheet View TouchableOpacity Text from "react-native";import AlertPro from "react-native-alert-pro"; { return <View => <Text =>REACT NATIVE ALERT PRO</Text> <View => <TouchableOpacity = = > <Text =>CUSTOM</Text> </TouchableOpacity> </View> <AlertPro = = ="Delete confirmation" ="Are you sure to delete the entry?" ="Cancel" ="Delete" = /> </View> ; } const styles = StyleSheet; ;
Dynamic AlertPro
<View> <Button =` $` = /> <AlertPro = =`$` = /> </View> ;
Props
Prop | Type | Description | Default |
---|---|---|---|
title | string | AlertPro's title | "Do you want to continue?" |
message | string | AlertPro's message | "" |
showCancel | boolean | Show a Cancel button | true |
showConfirm | boolean | Show a Confirm button | true |
textCancel | string | Text display on Cancel button | "No" |
textConfirm | string | Text display on Confirm button | "Yes" |
closeOnPressMask | boolean | Close AlertPro when press on mask (The empty space area) | true |
closeOnPressBack | boolean | Press back android to close Bottom Sheet (Android only) | true |
useNativeDriver | boolean | Allowing native code to perform the animation | false |
customStyles | object | Custom style to AlertPro | {} |
onCancel | function | Event on Cancel button | null |
onConfirm | function | Event on Confirm button | null |
onClose | function | Callback function when AlertPro has closed | null |
Available Custom Style
customStyles: title: ... // AlertPro's title message: ... // AlertPro's message mask: ... // The empty space area container: ... // AlertPro container buttonCancel: ... // Cancel button buttonConfirm: ... // Confirm button textCancel: ... // Cancel button's Text textConfirm: ... // Confirm button's Text
Methods
Method Name | Description |
---|---|
open | Open AlertPro |
close | Close AlertPro |
Note
Always set ref
to AlertPro
and call each method by using this.AlertPro.methodName()
like example above.
Give me a Star
If you think this project is helpful just give me a ⭐️ Star is enough because i don't drink coffee :D
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Author
Made with ❤️ by NY Samnang.