Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - secureTextEntry Disable IOS 13+ Strong Password behavior

I have an create account form in my app and now on iOS devices running 13+ I'm having an issue where if the the user presses the "done" key while entering a password the normal secure password dots are replaced with the following (see below). How to disable this behavior so it continues to work as it did on older devices?

enter image description here

like image 613
Sean Tansey Avatar asked Nov 25 '19 18:11

Sean Tansey


4 Answers

Try the following prop:

textContentType={'oneTimeCode'}

like image 151
dev Avatar answered Oct 16 '22 16:10

dev


Not a optimal solution, but adding blurOnSubmit, and a keyboard Dismiss on submit seems to get the desired behavior back:

import { Keyboard } from 'react-native'

<TextInput
   ...
   blurOnSubmit={false}
   onSubmitEditing={()=> Keyboard.dismiss()}
/>

like image 38
Sean Tansey Avatar answered Oct 16 '22 16:10

Sean Tansey


This problem occurs only if I use two TextInput components with secureTextEntry set to true.

If you don't need that, you might want to get rid of the second TextInput component.

You can also hack around with the value of secureTextEntry, e.g. setting it only to true when onFocus event was triggered and evolve it from there. (see: https://github.com/facebook/react-native/issues/27586#issuecomment-580739397)

like image 44
Björn W Avatar answered Oct 16 '22 16:10

Björn W


The best solution so far is to disable the simulator strong password feature.

Go to:

  1. Settings
  2. Passwords
  3. It will ask for a password! Type anything and tap on Done.
  4. Turn On AutoFill Passwords and turn it Off again.

Source: Strong password autofill appears in iOS simulator

like image 2
parse Avatar answered Oct 16 '22 15:10

parse