Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReactNative textcontenttype iOS 13 Issue

Tags:

We are not able to get Email, Name, phone number suggestions (autocomplete) to work on our React Native. Can someone help on troubleshooting to see what we may be doing wrong here?

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}
             />
like image 323
Chirag Avatar asked Sep 23 '19 19:09

Chirag


1 Answers

It does work in iOS 13. Just use the settings described here, and translate them from Swift to React Native:

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

For phone number:

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

For email:

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

You'll need to use a different keyboard type for Android, so probably something like:

keyboardType={(Platform.OS === 'ios') ? "numbers-and-punctuation" : 'phone-pad"}
like image 179
jason Avatar answered Oct 18 '22 20:10

jason