我正在使用react native元素输入。每当我在键盘上键入一个键时,它就会失去焦点
以下是版本详细信息
反应性-0.59.5 操作系统-MAC
<KeyboardAvoidingView behavior={Platform.OS == 'ios' ? 'position' : 'padding'} enabled keyboardVerticalOffset={Platform.OS == 'ios' ? dimensions.appBarHeight + getStatusBarHeight() + 10 : -100}>
<View style={{
backgroundColor: "#ffffff",
padding: 15,
flexDirection: "row",
height: 140,
borderColor: colors.greyLighter,
borderTopWidth: Platform.OS == 'android' ? 1 : 0,
shadowOffset: { "width": 0, "height": -3 },
shadowColor: "black",
shadowOpacity: 0.1,
alignItems: 'center'
}}>
<Input
inputStyle={{ fontSize: fontSizes.medium }}
inputContainerStyle={{
position: "relative",
padding: 10,
marginRight: 30,
flex: 1,
backgroundColor: "#f8f8f8",
borderRadius: 10,
borderColor: colors.greyLighter,
borderWidth: 1,
justifyContent: 'flex-start'
}}
multiline
placeholderTextColor={colors.greyDarker}
placeholder={'Your Comment'}
value={commentText}
onChangeText={setCommentText}
/>
<TouchableOpacity style={{ height: 32, width: 32, marginLeft: -30 }} onPress={onPostPressed.bind(this, props, navProps.activity)}>
<Image
style={{ height: '100%', width: '100%' }}
source={commentText == '' ? require('../../../assets/images/send-disabled.png') : require('../../../assets/images/send.png')}
/>
</TouchableOpacity>
</View>
</KeyboardAvoidingView>
SetCommentText:
setCommentText: ({ setCommentText }) => text => {
setCommentText(text);
}
我希望每当我按下一个键时键盘都不会关闭