Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Modernizing this code a bit more, converting it to hooks. Changelog: [General][Changed] Converted TextInput to use React hooks [General][Fixed] TextInput now properly sends native the end selection location on change (Note: this ignores all push blocking failures!) Reviewed By: JoshuaGross Differential Revision: D18581712 fbshipit-source-id: 62d6ea8489fa019ddf941c520930365f2c4887d8
- Loading branch information
dff490d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍
dff490d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kelset @TheSavior this rewrite seems to cause issues with using controlled text/selection, the extra setState to remember lastNativeText/Selection seems to interact poorly with whatever logic lives on the native side. If you want to do anything besides just reflect back the text/selection values given to you by the text input itself, things get really wonky, and kinda unusable, pretty quick. I've had to fall back to using RN's TextInput completely uncontrolled and have a controlled wrapper around it that calls setNativeProps to adjust text/selection.
dff490d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garrettm can you please open a dedicated issue with a repro on latest (0.62)? This is not the best place to report 😅
dff490d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@garrettm Since this is actually now broken, do you have an example of how you fixed it temporarily using
setNativeProps
? I'd love to not have to downgrade to get this working again :) (Waiting on some more movement in #29063)Thanks!
dff490d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikefogg our fix is pretty specific to our codebase, the high level is:
It's pretty involved, has a bunch of hacks, and doesn't work all the time. If I was gonna do it again, I'd probably just fork the native code...
dff490d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mikefogg @garrettm can you please move your comments in the issue Mike linked? That way your insights can benefit everyone more easily. I've linked the issue in the contributors discord so that hopefully it will be surfaced more quickly to the FB team
dff490d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kelset copied my comment over there 👍