-
Notifications
You must be signed in to change notification settings - Fork 49.2k
Add findHostInstance_deprecated to the React Native Renderer #17224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or 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
elicwhite
commented
Oct 30, 2019
@@ -779,6 +779,81 @@ describe('ReactFabric', () => { | |||
expect(touchStart2).toBeCalled(); | |||
}); | |||
|
|||
it('findHostInstance_deprecated should warn if used to find a host component inside StrictMode', () => { |
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.
These tests are copy pasted from findNodeHandle
's with different assertions
Size changes (stable)Details of bundled changes.Comparing: 8eee0eb...755e46c react-native-renderer
|
Size changes (experimental)Details of bundled changes.Comparing: 8eee0eb...755e46c react-native-renderer
|
sebmarkbage
approved these changes
Oct 30, 2019
elicwhite
added a commit
to elicwhite/react
that referenced
this pull request
Oct 30, 2019
elicwhite
added a commit
to elicwhite/react
that referenced
this pull request
Oct 31, 2019
trueadm
pushed a commit
to trueadm/react
that referenced
this pull request
Nov 4, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In ReactNative TouchableNativeFeedback clones its child passing through handlers that get attached to a host instance. It also dispatches commands like:
In order to get this off of
UIManager.dispatchViewManagerCommand
we need to use the new API which requires a direct ref to a host component. Unfortunately, since TouchableNativeFeedback uses cloneElement, it doesn't currently require its children to be host components so it can't attach a ref itself.This PR adds a new internal and immediately deprecated API to the renderers that works the same as
findNodeHandle
but returns the component instance itself instead of thenativeTag
on the instance. This API is only needed for TouchableNativeFeedback to maintain backwards compatibility as we migrate it to support Fabric.We also have a new API coming that will replace TouchableNativeFeedback that doesn't use cloneElement. Once that is out and TouchableNativeFeedback is deleted we will be able to get rid of this API.
For Facebook employees, see https://fb.workplace.com/groups/rn.fabric/permalink/1617555541709199/