在react-native中我有一个TextInput元素,当你点击它时,键盘会根据需要弹出.然而,问题是,我有你点击,当你输入你的输入输入到TextInput但按钮上的第一触摸或其他任何地方总是只删除键盘和不运行上的箭头按钮onPress功能的箭头按钮.当我输入文本并仍然使用键盘时,如何制作它.下一次按下都会移除键盘并执行按钮上的onPress功能.现在用户必须双击.一旦删除键盘,然后第二次执行onPress的功能.
<View style={{flex: 1,backgroundColor: "#b70f42", justifyContent: "center", alignItems: "center"}}>
<View style={{position: "relative"}}>
<TextInput
style={{color: "#FFF", borderBottomColor: "#FFF", borderBottomWidth: 1,fontSize:30,padding: 0, paddingRight: 50,height: 40,width: this.state.width*3/4,shadowOffset: { width: 0, height: 0 }, shadowColor: 'black', shadowOpacity: 0.5, shadowRadius: 5}}
onChangeText={(passwordInput) => this.showArrow(passwordInput)}
value={this.state.passwordInput}
placeholder="Vart ska du?"
placeholderTextColor="#FFF"
/>
<Text style={{marginLeft: 175,color:"#FFF"}}>Powered by IBM</Text>
<TouchableHighlight underlayColor="rgba(255,255,255,0)" style={{position: "absolute", top: 0, right: 5,}} onPress={() => this.onSearchButtonClick()}>
<Animated.Image
source={require("../../img/right-arrow.png")}
style={{width:40, height: 40,opacity: this.state.arrowOpacity}}>
</Animated.Image>
</TouchableHighlight>
</View>
</View>
Run Code Online (Sandbox Code Playgroud) react-native ×1