我正在使用这个模块,问题是弹出的 Dialogue 元素是一个 Modal,有两个 TouchableOpacity 按钮。键入后,当键盘打开时,单击“提交”TouchableOpacity 将首先清除/隐藏键盘,只有第二次点击“提交”TouchableOpacity 才会触发 onPress 事件。我可以做些什么作为解决方法?我尝试将其更改为 Button fromreact-native和 fromreact-native-elements但它的行为方式相同。
编辑:
组件:
return (
<Modal
animationType="fade"
transparent={true}
visible={this.props.isDialogVisible}
onRequestClose={() => {
this.props.closeDialog();
this.setState({ inputModal: "" });
}}
>
<View style={[styles.container, { ...modalStyleProps }]}>
<TouchableOpacity
style={styles.container}
activeOpacity={1}
onPress={() => {
this.props.closeDialog();
this.setState({ inputModal: "", openning: true });
}}
>
<View style={[styles.modal_container, { ...dialogStyleProps }]}>
<View style={styles.modal_body}>
<Text style={styles.title_modal}>{title}</Text>
<Text
style={[
this.props.message ? styles.message_modal : { height: 0 }
]}
>
{this.props.message}
</Text> …Run Code Online (Sandbox Code Playgroud)