-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make Fabric event receivers init only once #6907
base: main
Are you sure you want to change the base?
Conversation
...ges/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/NodesManager.java
Outdated
Show resolved
Hide resolved
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.
Can we somehow move the event subscription bits to the same place in the code?
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.
@tjzel we could. Here, I targeted only the given problem without taking any risk in refactoring the code, so I believe we could do that in a seperate PR 😄
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.
If it's a major refactor then leave it since we don't want to put too much effort into refactoring Paper code. If it's minor we could include it here.
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.
I'll see about it, but they are being initialized from two different contexts - paper goes through the usual initializer, fabric gets a initiWithContext
method, sounds fishy
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.
Code looks good to me, haven't tested it though, let's wait for approvals from other reviewers
Summary
Fixes #6896
When adding support for fabric, we have inadvertently kept previous listeners still active for fabric. This way, we registered twice with the same
NodesManager
for React Native'sFabricEventDispatcher
, resulting in pretty much all the events doubling in number on android. I added a simple check that takes care of it.Test plan
Paste the following into
EmptyExample
and runFabricExample
. Check logs making sure that bothstart
andend
are logged only once per gesture.