React native Can';在文本框外单击时,不能模糊显示输入
我有一个简短的表单,它有两个FormInput字段(来自react原生元素)。当触摸屏幕上文本输入之外的任何地方时,我尝试了几种方法来消除焦点(并隐藏键盘)React native Can';在文本框外单击时,不能模糊显示输入,react-native,react-native-elements,React Native,React Native Elements,我有一个简短的表单,它有两个FormInput字段(来自react原生元素)。当触摸屏幕上文本输入之外的任何地方时,我尝试了几种方法来消除焦点(并隐藏键盘) <View style={{flex:1}}> <ScrollView keyboardShouldPersistTaps="handled"> <FormInput placeholder='Phone Number' errorStyle={{ color:
<View style={{flex:1}}>
<ScrollView keyboardShouldPersistTaps="handled">
<FormInput
placeholder='Phone Number'
errorStyle={{ color: 'red' }}
inputStyle={{ color: 'white', fontSize: 20, fontFamily: 'Roboto-Thin', borderBottomColor: 'transparent'}}
placeholderTextColor='white'
onChangeText = {this.onPhoneChange.bind(this)}
containerStyle = {{ borderBottomWidth: 1, borderBottomColor: '#4DB1AD', width: '90%'}}
keyboardType='numeric'
maxLength={10}
/>
</ScrollView>
</View>
我也试过了
<TouchableWithoutFeedback style={{flex: 1}} onPress={Keyboard.dismiss} accessible={false}>
<View>
<FormInput
placeholder='Phone Number'
errorStyle={{ color: 'red' }}
inputStyle={{ color: 'white', fontSize: 20, fontFamily: 'Roboto-Thin', borderBottomColor: 'transparent'}}
placeholderTextColor='white'
onChangeText = {this.onPhoneChange.bind(this)}
containerStyle = {{ borderBottomWidth: 1, borderBottomColor: '#4DB1AD', width: '90%'}}
keyboardType='numeric'
maxLength={10}
onSubmitEditing={Keyboard.dismiss}
onBlur={Keyboard.dismiss}
blurOnSubmit={true}
/>
</View>
</TouchableWithoutFeedback>
这个方法呢
<TouchableOpacity activeOpacity={1} onPress={() => Keyboard.dismiss()}>
<FormInput
placeholder='Phone Number'
errorStyle={{ color: 'red' }}
inputStyle={{ color: 'white', fontSize: 20, fontFamily: 'Roboto-Thin', borderBottomColor: 'transparent'}}
placeholderTextColor='white'
onChangeText = {this.onPhoneChange.bind(this)}
containerStyle = {{ borderBottomWidth: 1, borderBottomColor: '#4DB1AD', width: '90%'}}
keyboardType='numeric'
maxLength={10}
/>
</TouchableOpacity>
Keyboard.disclose()}>
不幸的是,这些解决方案都不适合我