在react native中,我有一个TextInput元素,当你点击它时,键盘会根据需要弹出.然而,问题是,我有一个箭头按钮,当您将输入输入文本输入时,您可以单击该按钮,但第一次touch 该按钮或任何其他地方时,总是只会删除键盘,而不会在箭头按钮上运行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>