You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Root.jsimportstorefrom'./reduxStore';importReactfrom'react';import{Provider}from'react-redux';import{useRefBottomAlert,BottomAlert}from'react-native-modal-bottom-alert';// Add This For Set AlertletApp=()=>(<Navigator><MainScreen/><OtherScreen/></Navigator>);constRoot=()=>(<Providerstore={store}><App/>{/* Add This on root app */}<BottomAlertref={(ref)=>useRefBottomAlert(ref)}/></Provider>);
2. Add on your screen or other function
// Screen.jsimportReact,{Component}from'react';import{StyleSheet,Text,View,Button}from'react-native';import{showBottomAlert}from'react-native-modal-bottom-alert';// Add This On Your Screen For Call AlertexportdefaultclassAppextendsComponent{onOpenAlert(){showBottomAlert('info','This Title','This Message Example Info',()=>this.onDonePress())}onDonePress=()=>{console.log('Pressed')}render(){return(<Viewstyle={styles.container}><Textstyle={styles.welcome}>Modal Bottom Alert example</Text><Buttontitle={'Info'}onPress={()=>this.onOpenAlert()}/><Buttontitle={'Error'}onPress={()=>showBottomAlert('error','This Title','This Message Example Error')}/><Buttontitle={'Success'}onPress={()=>showBottomAlert('success','This Title','This Message Example Success')}/></View>);}}conststyles=StyleSheet.create({container: {flex: 1,justifyContent: 'space-around',alignItems: 'center',backgroundColor: '#F5FCFF',},welcome: {fontSize: 20,textAlign: 'center',margin: 10,}});