[Android] Crashes when secureTextEntry is not a boolean
I found a interesting thing.When I use the TextInput with secureTextEntry property.If
.
Thanks for reporting. You should use secureTextEntry={true} as that property is defined as boolean here: https://github.com/facebook/react-native/blob/master/Libraries/Components/TextInput/TextInput.js#L232
It's not intended that it works on iOS passed as a string. This is related to some implicit casting and I'm afraid that secureTextEntru='false' may also be interpreted on iOS as true.
This problem should've been caught by flow, not sure if you're using flow by any chance?
cc: @sahrens
As a shortcut, you could just do secureTextEntry without the ={true}. Only if you want to disable it do you need to specify the boolean property :) But yeah, this probably shouldn't cause a crash
IMO it should definitely be a red-box, in that case it's even very clear one. Property is of type "bool" and you're providing a "string".
I think that we expect RN to give you a similar error when you set string as value for alpha or translationX, that's a very similar case. I believe we should instead add some type-checking to iOS native code.
We shouldn't accept strings as booleans, created https://github.com/facebook/react-native/issues/3003 to make this consistent on iOS and Android.