- Notifications
You must be signed in to change notification settings - Fork15
The Pro Version of React Native Alert (Android & iOS)
License
NotificationsYou must be signed in to change notification settings
nysamnang/react-native-alert-pro
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
- 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 |
|---|---|
![]() | ![]() |
npm i react-native-alert-pro --saveyarn add react-native-alert-proimportReact,{Component}from"react";import{StyleSheet,View,TouchableOpacity,Text}from"react-native";importAlertProfrom"react-native-alert-pro";classExampleextendsComponent{render(){return(<Viewstyle={styles.container}><Textstyle={styles.title}>REACT NATIVE ALERT PRO</Text><Viewstyle={styles.buttonContainer}><TouchableOpacityonPress={()=>this.AlertPro.open()}style={styles.button}><Textstyle={styles.text}>CUSTOM</Text></TouchableOpacity></View><AlertProref={ref=>{this.AlertPro=ref;}}onConfirm={()=>this.AlertPro.close()}title="Delete confirmation"message="Are you sure to delete the entry?"textCancel="Cancel"textConfirm="Delete"customStyles={{mask:{backgroundColor:"transparent"},container:{borderWidth:1,borderColor:"#9900cc",shadowColor:"#000000",shadowOpacity:0.1,shadowRadius:10},buttonCancel:{backgroundColor:"#4da6ff"},buttonConfirm:{backgroundColor:"#ffa31a"}}}/></View>);}}conststyles=StyleSheet.create({container:{flex:1,alignItems:"center",backgroundColor:"#fff"},title:{fontSize:20,marginTop:120},buttonContainer:{flex:1,alignItems:"center",justifyContent:"center",backgroundColor:"#FFFFFF"},button:{backgroundColor:"#4EB151",paddingVertical:11,paddingHorizontal:17,borderRadius:3,marginBottom:15},text:{color:"#FFFFFF",fontSize:16,fontWeight:"600"}});exportdefaultExample;
renderItem=(item,index)=>(<View><Buttontitle={`OPEN AlertPro-${index}`}onPress={()=>this[AlertPro+index].open()}/><AlertProref={ref=>{this[AlertPro+index]=ref;}}title={`AlertPro-${index}`}onConfirm={()=>this[AlertPro+index].close()}/></View>);
| 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 |
customStyles:{title:{...},// AlertPro's titlemessage:{...},// AlertPro's messagemask:{...},// The empty space areacontainer:{...},// AlertPro containerbuttonCancel:{...},// Cancel buttonbuttonConfirm:{...},// Confirm buttontextCancel:{...},// Cancel button's TexttextConfirm:{...}// Confirm button's Text}
| Method Name | Description |
|---|---|
| open | Open AlertPro |
| close | Close AlertPro |
Always setref toAlertPro and call each method by usingthis.AlertPro.methodName() like example above.
If you think this project is helpful just give me a ⭐️ Star is enough because i don't drink coffee :D
This project is licensed under the MIT License - see theLICENSE.md file for details
Made with ❤️ byNY Samnang.
About
The Pro Version of React Native Alert (Android & iOS)
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
No packages published
Uh oh!
There was an error while loading.Please reload this page.

