Skip to content

Instantly share code, notes, and snippets.

@ferrannp
Created January 22, 2020 15:48
Show Gist options
  • Save ferrannp/368922f1e4c9cce65174ee9f3375ac4a to your computer and use it in GitHub Desktop.
Save ferrannp/368922f1e4c9cce65174ee9f3375ac4a to your computer and use it in GitHub Desktop.
// MainActivity.java
public void switchToReactView() {
if (mReactRootView != null && !mReactRootView.isAttachedToWindow()) {
mReactRootView.setAlpha(0f);
mReactRootView.animate()
.alpha(1f)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setDuration(350)
.setListener(new Animator.AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
setContentView(mReactRootView);
}
@Override
public void onAnimationEnd(Animator animation) {
setTheme(R.style.AppTheme);
}
@Override
public void onAnimationCancel(Animator animation) {
}
@Override
public void onAnimationRepeat(Animator animation) {
}
})
.start();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment