-
-
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
BEGAN state isn't handled if taps are very quick #596
Comments
Please take a look at the attached GIF demonstrating how the button doesn't react to "soft" taps while "hard" taps work. To reproduce this And the source code for this component can be found here |
Any response by the maintainers here would be appreciated :) |
@kmagiera any thoughts on this? |
Thanks for this report and investing your time investigating this issue. I understand the root cause and wonder if you know if this has any impact outside of the domain of automated testing? That is whether it is possible for touch screens to report events with such frequency if they are touched vs events being generated by external sources (mouse clicks, automation) |
@kmagiera we've tried it on high-end devices and when running our apps smoothly (high refresh-rates) the taps seem to always be registered properly. However, it is fairly easy to reproduce not just in the domain of automation, but with usage of emulators / simulators on dev computers. For example, the apple trackpad seems sensitive enough so as to allow for an easy reproduction. I imagine that also in some low-end devices, where refresh rates are low, this bug might be an issue as well. Nevertheless automation is paramount, esp. with Detox as it is already integrated into React Native's CI itself. I don't know what tests look like there, but assuming reanimated components are bundled in at some point, they might endure flakiness on Android. Last but not least, I can't help but feel I ought to emphasize that the root of the problem here is in the architectural core. Namely, this specific bug is most likely merely a single symptom, and it is not unlikely that similar issues exist and that are waiting to be found (with the same root cause). |
Update: this seems to also happen, at times, on iOS devices as well, in automation using |
@kmagiera this is also reproducible on slow devices, where frames are more easily dropped. |
@kmagiera So given the situation, we're now considering submitting a fix through a PR. I tried a few naive solutions such as maintaining a values queue inside Do you have any suggestions as to how we should approach this, given the broader outlook on things? |
Hey, sorry for delay responding here. And apologies for not being able to focus on this right now to verify my suggestion. One thing I was interested in checking re this issue is whether the event is triggered correct number of times. As far as I understand the issue, we run some updates using I would consider the above as a workaround. We are currently working on rewriting core parts of reanimated and think that this problem is not going to be relevant after the change we are making. We expected the above to be ready for beta tests end of April. |
@kmagiera good to hear, and thanks for responding nonetheless! |
v2 has been released recently, I think it's worth checking it out. This issue is mostly connected with the automated test system and shouldn't affect real users so I believe we can close it. |
It seems like in e2e tests the detox tap() is too fast for RNGH to register, causing button taps to fail: software-mansion/react-native-reanimated#596
…dit (#472) * chore: use react-native touchables in tests (RNGH = flaky tests) It seems like in e2e tests the detox tap() is too fast for RNGH to register, causing button taps to fail: software-mansion/react-native-reanimated#596 * fix: Show "discard edits" not "discard observation" when cancelling edit fixes #381 * add tests * fix crash in test
Description
Assuming even a simple JS-side reanimated-
Code
block that depends on bothBEGAN
andEND
states (associated with down and up press events from a tap), theBEGAN
state will not be handled if the tap gesture (touch and release) is done very quickly.In particular, we find this to be an issue with automated tests written with Detox.
For example, consider this simple usage of reanimated:
If the tap is performed really fast, the
BEGAN
will not be fired, and with that the opacity flicker will not take place.Root cause
I've done some research as to what causes this and this is what I dug up.
The root of the problem - on Android, at least, is that the history of states doesn't get recorded in
ValueNode
s. Rather,ValueNode
s only keep the most recent value set to it. Combined with the fact that these updates' handling is only triggered via the choreographer's callback - which is only dispatched async'ly in ~16ms intervals, if the gap between events is small enough (i.e. both take place fast enough to precede the next callback exec) then you end up with theBEGAN
getting lost, and only theACTIVE
andEND
being handled.Additional Artefacts, Reproduction
In essence, this can be reproduced by running Wix' public RN UI-Lib project's demo app, as explained by @ethanshar's comment below.
Technical Info
0.61.5
1.7.0
The text was updated successfully, but these errors were encountered: