ReactNative textcontenttype iOS 13问题

问题描述 投票:5回答:1

我们无法获得电子邮件,姓名,电话号码建议(自动完成)以在我们的React Native上使用。有人可以帮助您进行故障排除,以了解我们在这里做错了什么吗?

https://facebook.github.io/react-native/docs/textinput#textcontenttype

<Input
               placeholder="First Name"
               textContentType="givenName"
               onChangeText={firstname => (onChange('first_name', firstname))}
               value={state.form.first_name}
               autoCapitalize="words"
               placeholderTextColor={'#262626'}
               style={styles.textInput}
             />
react-native autofill ios13
1个回答
0
投票

它在iOS 13中确实有效。只需使用此处描述的设置,并将其从Swift转换为React Native:

After updating to iOS 13 suggestion(email, phone number, first name...) for UITextField don't appear above keyboard

电话号码:

autoCorrect={true}
textContentType="telephoneNumber"
keyboardType="numbers-and-punctuation"

对于电子邮件:

autoCorrect={true}
textContentType="emailAddress"
keyboardType="email-address"

您需要为Android使用其他键盘类型,因此可能类似于:

keyboardType={(Platform.OS === 'IOS') ? "numbers-and-punctuation" : 'phone-pad"}
© www.soinside.com 2019 - 2024. All rights reserved.