react-natie删除提示如何实现
导读:本文共996字符,通常情况下阅读需要3分钟。同时您也可以点击右侧朗读,来听本文内容。按键盘←(左) →(右) 方向键可以翻页。
摘要:接下来,请跟着小编一起来学习吧! react-natie删除提示的实现方法:1、通过“import React from 'react';”引入react;2、通过“ showConfirm=()=>{Alert.alert('','除... ...
目录
(为您整理了一些要点),点击可以直达。接下来,请跟着小编一起来学习吧!
react-natie删除提示的实现方法:1、通过“import React from 'react';”引入react;2、通过“ showConfirm=()=>{Alert.alert('','除',[{text:'',onPress:() => Alert.alert("") },{text:'',style:'cancel'}],{...}”方法实现删除确认框即可。
react native 弹框和删除确认框
importReactfrom'react';
import{
Alert,Button,View,Text,TouchableOpacity,StyleSheet
}from'react-native';
exportdefaultclassAppextendsReact.Component{
showAlert=()=>{
Alert.alert("点击了弹出框")
};
showConfirm=()=>{
Alert.alert('警告','确认删除',[
{text:'确认',onPress:()=>Alert.alert("点击了确认")},
{text:'取消',style:'cancel'}
],{cancelable:false});
};
render(){
return(
<Viewstyle={styles.container}>
<Viewstyle={styles.buttonView}><ButtononPress={this.showAlert}title={"点击显示alert"}/></View>
<Viewstyle={styles.buttonView}><ButtononPress={this.showConfirm}title={"点击显示确认框"}/></View>
</View>
)
}
}
conststyles=StyleSheet.create({
container:{
marginTop:20,
marginHorizontal:10
},
buttonView:{
margin:10,
height:40
}
});
react-natie删除提示如何实现的详细内容,希望对您有所帮助,信息来源于网络。