-
Notifications
You must be signed in to change notification settings - Fork 24.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TextInput clears text when secureTextEntry is true #35668
Comments
Hey I have the same problem but I can't find the code inside node_modules/react-native to change it. Please help!!! |
@NarekAvagyan777 Sorry for late reply, you can change native code below path. |
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue still exists. Do you have any workarouns? |
Issue is still happening on IOS. |
how to get rid of that yellow background for inputs when u choose to "use a strong password"? |
@AlgoRoots Thanks for sharing the solution, but it's leading to another issue. The swipe-to-type gesture was not working, and the IOS app was hanging and crashing. Here's the modified code with a solution to both issues.
|
Care to create a patch and a PR? thanks! |
When a secureTextEntry is true and I try to edit it, it keeps getting cleared. This PR solves this by patching function `shouldChangeCharactersInRange` adding a condition that checks `isSecureTextEntry` in `textfield` is true so overrides the behaviour of clearing the text, the change was done in the file `RCTBackedTextInputDelegateAdapter.mm` This fixes facebook#35668
I believe @adnan-khan1122 is waiting for feedback on #45964 that PR should close this and #46154 |
I am working on a project with react native but I am still facing the issue did i miss a step or the patch is no longer compatible with new version |
@alimurad-1 patch is still valid. Don't forget to apply patching after adding code using |
reinstalling the app resolved the issue...thank you |
When a secureTextEntry is true and I try to edit it, it keeps getting cleared. This PR solves this by patching function `shouldChangeCharactersInRange` adding a condition that checks `isSecureTextEntry` in `textfield` is true so overrides the behaviour of clearing the text, the change was done in the file `RCTBackedTextInputDelegateAdapter.mm` This fixes facebook#35668
Description
Hi, I am having an issue with my UITextField, When a secureTextEntry is true and I try to edit it, it keeps getting cleared.
I understand that it works as intended by IOS, but I would like to keep password value when I try to edit.
Version
0.70.0
Output of
npx react-native info
System:
OS: macOS 12.3.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 30.74 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.15.0 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 9.2.0 - ~/reactnative/node_modules/.bin/npm
Watchman: 2022.10.03.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^18.2.0 => 18.2.0
react-native: ^0.70.0 => 0.70.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
Snack, code example, screenshot, or link to a repository
After looking for a workaround, I was able to modify native code in node module using patch-package
Here is the path i tried to edit code
// node_modules/react-native/
// Libraries/Text/TextInput/RCTBackedTextInputDelegateAdapter.m
Before
After
it solved the password reset problem. However As you can see, there is a major flaw in this code.
The variable called _backedTextInputView has disappeared, and modified code has applied to all textField, so consonants and vowels are separated when writing in Korean.
So, I wonder if there is a way to apply the after code written above only when secureTextEntry is true while maintaining the existing code.
p.s. I wonder if React-native team can generate the corresponding props. (e.g. textFiled.clearsOnBeginEditing.)
The text was updated successfully, but these errors were encountered: