Skip to content
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

Adapt to react-native's changes to ReactNativeBridgeEventPlugin #199

Merged
merged 2 commits into from
Jun 5, 2018

Conversation

kmagiera
Copy link
Member

Fixes #191

ReactNativeBridgeEventPlugin got removed here: facebook/react-native@906dde0

We used to rely on ReactNativeBridgeEventPlugin to register gesture specific event types. Without it, react will throw an error whenever gesture event gets dispatched as the even type would not be recognized by the react event system.

To fix that I had to find a way to inject event type configuration. The most robust solution I have found was to override event config of RCTView. A view that is a baseclass for all the other components in the system. Adding gesture handler event types to RCTView configuration guarantees that these will be properly registered in event registry before any event gets dispatched.

This change renders whole idea of "DummyViewManager" obsolete. The role of "DummyViewManager" was at first to export event type configuration to JS and let react consume that view configuration to register new event types.
This changed when view manager lazy loading got introduced and the configuration wouldn't be parsed unless at least one instance of the "DummyView" got mounted.
To overcome this issue we started relying on ReactNativeBridgeEventPlugin to force register new event types. But we still needed dummy view manager on Android as it has been used by CustomEventNamesResolver to translate event registration name ("topGestureHandler" to "onGestureHandler").
The latter has been resolved by changing the registration and event name to be the same by ditching weird "topXXX" prefix. We now only use "onGestureHandler..." as a prefix for events which does no longer require us to have event configuration on the native side.

@kmagiera kmagiera requested a review from osdnk June 5, 2018 08:37
Copy link
Contributor

@osdnk osdnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🇧🇷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReactNativeBridgeEventPlugin can not be used anymore
3 participants