Open AliRezaBeigy opened 6 days ago
The problem solve by disable new architecture
I do not see this issue. For me secureTextEntry works as expected. RN 0.76.1, Expo
Hey @AliRezaBeigy, could you provide a public link to the repro?
As @Barney4242 comment, this is working.
Hello, I apologize for the misinformation in my previous comment. After further testing, I've identified that the issue specifically arises when using setNativeProps. This functionality works as expected in React Native 0.75.4, but in 0.76.1, it seems to break the dynamic toggling of secureTextEntry.
I've created a sample repository to reproduce this issue: https://github.com/AliRezaBeigy/ReactNativeSecureText
Thank you for your attention to this matter, and I apologize again for the oversight in my initial report.
@AliRezaBeigy Thanks for the issue.
This use case is not working with setNativeProps
in the New Architecture because of how the new Architecture is structured.
In the New Architecture we have 3 trees:
When React commits a change, it modifies the Shadow Tree and the Shadow Trees ask the native tree to render the UI. In this scenario, all the trees are always in synch.
When you use useNativeProps
, you bypass the update to the ShadowTree. This means that the ShadowTree is not aware that you changed the secureTextEntry
prop and the next commit from React will reset the value to the previous one.
We need to find a mechanism to sync the Native tree with the Shadow tree to make it work well.
Description
The
secureTextEntry
option inTextInput
does not work as expected in React Native 0.76.1. WhensecureTextEntry
is set totrue
, and the user types in the input, if the state changes tofalse
, the input still shows dots instead of plain text. Conversely, whensecureTextEntry
is initiallyfalse
and then toggled totrue
, the text remains visible.Steps to reproduce
TextInput
component withsecureTextEntry
controlled by a state variable.secureTextEntry
totrue
.false
and observe the text visibility.secureTextEntry
initially set tofalse
and toggle totrue
.React Native Version
0.76.1
Affected Platforms
Runtime - Android, Runtime - iOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/AliRezaBeigy/ReactNativeSecureText
Screenshots and Videos
No response