react-natie删除提示如何实现(react,web开发)

时间:2024-05-05 23:34:11 作者 : 石家庄SEO 分类 : web开发
  • TAG :

接下来,请跟着小编一起来学习吧!

react-natie删除提示的实现方法:1、通过“import React from 'react';”引入react;2、通过“ showConfirm=()=>{Alert.alert('','除',[{text:'',onPress:() => Alert.alert("") },{text:'',style:'cancel'}],{...}”方法实现删除确认框即可。

react native 弹框和删除确认框

react-natie删除提示如何实现

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删除提示如何实现的详细内容,希望对您有所帮助,信息来源于网络。
上一篇:react-router-dom路由跳转如何实现下一篇:

13 人围观 / 0 条评论 ↓快速评论↓

(必须)

(必须,保密)

阿狸1 阿狸2 阿狸3 阿狸4 阿狸5 阿狸6 阿狸7 阿狸8 阿狸9 阿狸10 阿狸11 阿狸12 阿狸13 阿狸14 阿狸15 阿狸16 阿狸17 阿狸18