Files
react-native/Libraries/Components/TextInput
Tim Yung 666f56bff3 TextInput: Switch to useMergeRefs
Summary:
Switches `TextInput` from `setAndForwardRefs` to `useMergeRefs` (and `useCallback`).

Instead of creating a new `_setNativeRef` function on every render, this will now only create a new ref function when either `mostRecentEventCount` changes, `viewCommands` (i.e. `props.multiline` on iOS) changes, or when `props.forwardedRef` changes.

When a text input is being edited, `mostRecentEventCount` will probably change. But when an unfocused `TextInput` is being updated because a parent is being updated, we will now no longer unnecessarily create a new `ref`. The observable behavior of this is that any `ref` supplied onto `TextInput` will now be invoked less frequently.

Changelog:
[General][Changed] Any `ref` set on `TextInput` will now be updated less frequently (when the underlying `ref` has not changed).

Reviewed By: sammy-SC

Differential Revision: D41191439

fbshipit-source-id: c69a061317c51ad6c6ca8acd116539e0f24a1d08
2022-11-12 09:17:00 -08:00
..
2022-10-26 11:24:16 -07:00
2022-11-02 14:58:37 -07:00
2022-11-12 09:17:00 -08:00