Auto Predict not working in iOS 13 with textContentType to TextInput

Viewed 408

textContentType={'telephoneNumber'} or textContentType={'name'}

supplied to TextInput component giving no result in iOS 13 or + but it works in iOS 12 or lower. Does any body help to overcome this problem.

2 Answers

From my own testing, iOS 13 only offers suggestions for a subset of their keyboards, and the default keyboard is not one of those types. Forgive me for not being able to give a React-Native answer, but if you find whatever maps to one of those keyboards, you should be good. The keyboard types (defined in UIKeyboardType) I've found that support suggestions are:

  • numbersAndPuncutation
  • URL
  • namePhonePad
  • emailAddress
  • twitter
  • webSearch

As @drdaanger points out this only seems to work if you use a specific keyboard type and explicitly set the autoCorrect type to default.

    ukPostcodeTextField.keyboardType.textContentType = .postalCode
    ukPostcodeTextField.keyboardType = .namePhonePad
    ukPostcodeTextField.autocorrectionType = .default

Annoyingly namePhonePad does not support autocapitalizationType so this line has no effect

    postcodeTextField.autocapitalizationType = .allCharacters

I assume that this not working for the default keyboard is an iOS 13 bug?

It is also worth pointing out that setting autocorrectionType to default means it does auto correct which is far from ideal when users are typing in their address.

Related