mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
7f80b1c8c7
Summary: The migration from classy to functional component partially broke controlled TextInput selections. This fixes it. The nuance is that even though we have "event counters" sent from native, "onChange" and "onChangeSelection" are separate events; so even if you receive new text and a new native event counter, your selection may be out-of-date. Incrementing the event counter when sending selection events breaks text updates; and adding another native event counter seems like overkill. Instead, in JS, we statefully keep track of (1) the native event counter, (2) whether or not the selection has been updated for that event counter. Changelog: [internal] Reviewed By: mdvacca Differential Revision: D18867152 fbshipit-source-id: c569ecd03ce0042d6feb5fa8af4c756588607a09