-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
iOS TextInput - text undo/redo doesn't work if value, defaultValue, or onChange is set #29572
Comments
I was able to work around this issue by creating a custom component as shown below, but it would great to see a proper fix for this.
|
We are already using a UI library that wraps TextInput, so using the above doesn't really work for us. |
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions. |
This is still an issue. |
I'm also seeing the occasional EXC_BAD_ACCESS "Attempted to dereference garbage pointer" error. @mhoran or someone please add the |
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. |
Still an issue. |
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 is still an issue in react-native 0.73.4 / Expo v50. In addition, the workaround posted above needed |
The hostname TextInput also suffers from facebook/react-native#29572.
This is how my fix looks like. Seems that it fix the issue, if you can ping and make my PR more visible so it can be review and merged will be awesome. If the steps I made aren't correct pleas send it again. I use the TextInput_with_fix_undo_test.mp4 |
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. |
Still an issue. |
I'm proposing another solution: #39385 (comment) |
This looks to still be an issue in 0.76.0 on New Arch with #46970 applied. |
This issue is fixed by the three patches mentioned in reactwg/react-native-releases#595 (comment). Those should make it into 0.76 once the pick request is complete. To test sooner, you can apply the patches to 0.76.0 via |
Please provide all the information requested. Issues that do not follow this format are likely to stall.
Description
Setting
value
, ordefaultValue
withonChange
will cause iOS undo/redo keyboard feature (mostly on iPads) to break or rarely work. Additionally, it may cause a native crash from time to time.Basically, the undo button gets enabled for half a second, and then gets disabled again. The issue will not happen if
value
ordefaultValue
is not set. I suspect this is related to the code that sends the JS value to native which in turn clears/updates the native input.React Native version:
Run
react-native info
in your terminal and copy the results here.Steps To Reproduce
<TextInput value={this.state.value}>
somewhere.Expected Results
Either undo/redo should not be possible, or it should behave just as if a native input was used (do not clear the stack after each component update)
Snack, code example, screenshot, or link to a repository:
The issue can be observed even with the sample code from the docs:
Additionally, the following crash will happen from time to time, presumably from this poor undo/redo handling of the component, or even Apple's source code.
Sample video:
The text was updated successfully, but these errors were encountered: