mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
666f56bff3
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