[Fix] Make sure that RCTEventEmitter is registered before emitting the first event #809
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.
Summary
React Native pager view emits an error when used with Nightlies on the New Architecture with and without the Bridge.
The reason is that Pager View copied a work around we also have in ScrollView to allow apps to implement complex animations, like parallax animations, but it forgot to add the JS side of it, that makes the workaround effective.
The JS part is to make sure that
RCTEventEmitter
is properly registered as CallableModule in the JS side.This PR adds that bit, copying what ScrollView does.
For context, we are not happy with this workaround. We still have to figure out properly how to fix it and, as soon as we know, we are going to provide guidance and/or submit a new PR to fix this for good, depending on how much time we will have
Test Plan
Tested locally using:
react-native@Nightly 0.74.0-nightly-20240208-b796cda38
[email protected]
What's required for testing (prerequisites)?
Being able to create and run a react native app.
What are the steps to reproduce (after prerequisites)?
then:
App.tsx
Compatibility
Checklist
README.md