-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
7bcc6f9
commit 666f56b
Showing
1 changed file
with
72 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters