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

Android: Support RN50-51 changes #652

Merged
merged 5 commits into from
Apr 4, 2018
Merged

Android: Support RN50-51 changes #652

merged 5 commits into from
Apr 4, 2018

Conversation

rotemmiz
Copy link
Member

@rotemmiz rotemmiz commented Mar 28, 2018

This PR aims to:

  1. Add support for changes made in NativeAnimatedModule
  2. Temp fix for waitForReactNativeLoad by adding Thread.sleep() on RN>=50, not ideal, but will enable usage of Detox on RN51 projects even before we find the true culprit of this sync defect.

@rotemmiz rotemmiz changed the title [WIP] Attempt to add fallback to broken sync Android: Support RN51 changes Apr 3, 2018
@rotemmiz rotemmiz requested a review from simonracz April 3, 2018 22:18
@rotemmiz rotemmiz changed the title Android: Support RN51 changes Android: Support RN50-51 changes Apr 3, 2018

static {
try {
Class reactNativeVersion = Class.forName("com.facebook.react.modules.systeminfo.ReactNativeVersion");
Copy link
Contributor

@simonracz simonracz Apr 4, 2018

Choose a reason for hiding this comment

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

This class is present only in RN 50 and above.

Later, the getMinor call could fail on these older versions. As we don't actually use this API on older versions, I think we could just set it to 49.5.0 in the catch as a default version.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch, thanks

if (callback != null) {
callback.onTransitionToIdle();
}
Log.i(LOG_TAG, "AnimatedModule is idle, no operations");
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we shouldn't log out idle states. Only busy states.

Originally, I also logged both states, but after the initial debugging it become overwhelming.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed

if (callback != null) {
callback.onTransitionToIdle();
}
Log.i(LOG_TAG, "AnimatedModule is idle, no operations");
Copy link
Contributor

@simonracz simonracz Apr 4, 2018

Choose a reason for hiding this comment

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

I looked at this diff.

I am not even sure that we need an animatedIdlingResource at all on later RN versions. It seems, they delegate everything to the UIModule. I don't fully understand the new flow in that code though.

The check here certainly doesn't do any harm.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, it was a trial and error kinda fix :)
But I think that there's a small gap between the time when the UIBlock is posted and when it starts executing.

Copy link
Contributor

@simonracz simonracz left a comment

Choose a reason for hiding this comment

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

Please check the VERSION checker comment.

The rest is ok for me.

@rotemmiz
Copy link
Member Author

rotemmiz commented Apr 4, 2018

Done deal

@simonracz
Copy link
Contributor

Awesome! 👍

@rotemmiz rotemmiz merged commit 0df3336 into master Apr 4, 2018
@rotemmiz rotemmiz deleted the RetryFailedInvocation branch May 25, 2018 18:11
@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants