我从'react-native'使用了KeyboardAvoidingView。一旦我专注于输入字段,键盘仍会覆盖输入。下面是我的代码
<KeyboardAvoidingView keyboardVerticalOffset = {0} style = {{ flex: 1 }} behavior = "padding" >
<ScrollView>
<View style={styles.formGroup}>
<Text style={styles.labelGroup}>{Question.howToReachJobVacancy }</Text>
<Field
component={CustomTextInput}
multiline={true}
numberOfLines={2}
placeholder='ចុចទីនេះដើម្បីសរសេរចម្លើយ'
/>
</View>
</ScrollView>
</KeyboardAvoidingView>
这是我的CustomTextInput。
<TextField {...inputProps}
value={input.value}
onChangeText={ input.onChange }
onBlur={input.onBlur}
onFocus={input.onFocus}
multiline={true}
labelHeight={0}}/>
我想在输入字段上修复iOS键盘弹出窗口。
答案 0 :(得分:0)
请尝试以下代码
<KeyboardAvoidingView behavior={(Platform.OS === 'ios' ? 'padding' : null)} style={{ flex: 0 }}>
<ScrollView>
<View style={styles.formGroup}>
<Text style={styles.labelGroup}>{Question.howToReachJobVacancy }</Text>
<Field
component={CustomTextInput}
multiline={true}
numberOfLines={2}
placeholder='ចុចទីនេះដើម្បីសរសេរចម្លើយ'
/>
</View>
</ScrollView>
</KeyboardAvoidingView>