我需要创建一个警报来说明用户是否确定要开始一项活动。我是这样做过的,但是不正确。我能做什么??const exercises = this.state.Exercises.map(exercise => { return ( <View key={exercise.Id}> <Text style={{ fontSize: 15 }}>Id: {exercise.Id} </Text> <Text style={{ fontSize: 15 }}>Rep: {exercise.Reps}</Text> <Text style={{ fontSize: 15 }}>Note: {exercise.Notes}</Text> <TouchableOpacity style={[styleButton.button, styleButton.buttonOK]} onPress={() => Alert.alert( 'Do you want to start?', [ { text: 'Si', onPress: () => this.check(exercise.Id)}, {text: 'No', onPress: () => this.homepage()} ] )} > <Text style={styleButton.buttonTesto}>Scegli</Text> </TouchableOpacity> </View> );});这是错误:按钮切片不是函数
2 回答
qq_花开花谢_0
TA贡献1835条经验 获得超7个赞
用这个
Alert.alert(
'Do you want to start',
[
{
text: 'No',
onPress: () => console.log('Canceled'),
style: 'cancel',
},
{text: 'Yes', onPress: () => console.log('Yes')},
],
{cancelable: false},
);
添加回答
举报
0/150
提交
取消