gou*_*iha 2 typescript react-native formik
我正在使用 KeyboardAvoidingView 通过键盘向上移动按钮,在其中我有一个滚动视图,keybordShouldPersistTaps 设置为始终,在滚动视图中,我使用的是 Formik 表单。我仍然需要双击一个按钮两次才能让键盘关闭并提交我的数据。我一直试图在没有运气的情况下手动关闭/处理滚动视图上的键盘,我应该尝试其他任何方法吗?
<KeyboardAvoidingView style={{ flex: 1 }} behavior={'padding'}>
<ScrollView contentContainerStyle={{ flexGrow: 1 }} keyboardShouldPersistTaps={'always'}>
<Formik
initialValues={this.state}
validationSchema={this.schema}
onSubmit={(values, actions) => {
actions.setSubmitting(false);
}}
render={({ handleBlur, handleChange, handleSubmit, values, isValid }) => {
return (
<View style={onboardingStyles.inputContainer}>
<View>
<Text theme={theme} style={onboardingStyles.headerText}>
{i18n.t('phone_verify')}
</Text>
<TextInput
activeHighlight
value={RizeCore.util.formatPhoneDOM(values.phone)}
onChangeText={(val: string) => {
const phone = RizeCore.util.parseOutDigits(val, 10);
return handleChange('phone')(phone);
}}
onBlur={() => handleBlur('phone')}
label={i18n.t('phone_number')}
style={onboardingStyles.input}
labelStyle={{ color: 'white' }}
keyboardType={Platform.OS === 'web' ? 'default' : 'number-pad'}
returnKeyType="done"
/>
</View>
<BottomFixedCTA
ctaLabel={i18n.t('phone_send_code')}
loading={smsCodeIsBusy}
disabled={!isValid}
onPress={handleSubmit as undefined}
onBackPress={this._navSignUp}
/>
</View>
);
}}
/>
</ScrollView>
</KeyboardAvoidingView>
Run Code Online (Sandbox Code Playgroud)
尝试使用:
keyboardShouldPersistTaps="handled"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1208 次 |
| 最近记录: |