react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[Android] Navigator transitions broken on 0.13

Open satya164 opened this issue 11 years ago • 16 comments

So, I upgraded my RN version in package.json and build.gradle and found that Navigator transitions are broken. I tried adding a configureScene property with no success.

navigator-example

satya164 avatar Oct 25 '15 15:10 satya164

same issue. All configs Navigator.SceneConfigs with translate doesn't work, only this strange fade effect like in satya164 case. FadeAndroid scene changes this ugly fade to little more better...

maxim-c avatar Oct 26 '15 09:10 maxim-c

+1

mangogogos avatar Oct 26 '15 23:10 mangogogos

same issue here as well, none of the slide transitions work, but the fade transitions work without a problem.

pagrawl3 avatar Oct 27 '15 04:10 pagrawl3

Thanks for the report and +1's everyone, @ericvicenti can you take a look?

astreet avatar Oct 27 '15 17:10 astreet

+1

JonnyBGod avatar Oct 30 '15 02:10 JonnyBGod

Any updates on this?

satya164 avatar Nov 02 '15 21:11 satya164

I haven't seen any changes to Navigator that would cause this, and there is no platform-specific code that would cause breakage only on Android.

To perform animations, Navigator calls setNativeProps on views within a requestAnimationFrame timer.

Maybe somebody could try bisecting to identify the breakage? I don't have bandwidth to figure this out in the next few weeks.

ericvicenti avatar Nov 02 '15 22:11 ericvicenti

I simply created the AwesomeProject tutorial and then added a Navigator to it and used the FloatFromRight transition. It works on iOS but it does not work on Android. The only transition that seems to work on Android is FadeAndroid, but that one is so subtle, it's hardly noticeable.

mbrochh avatar Nov 03 '15 01:11 mbrochh

I'm not entirely sure how it was broken, but the reason most transitions don't work is that they're using the wrong native prop.

buildStyleInterpolator creates a style with the transformMatrix property. Android expects the decomposed matrix in decomposedMatrix.

I hacked a change in Navigator.js _transitionSceneStyle which "fixes" the transitions (as in they work afterwards, but I'm sure this code change isn't really the one wanted):

    ...
    var didChange = useFn(styleToUse, directionAdjustedProgress);
    //
    if (styleToUse.transformMatrix)
      styleToUse = {...styleToUse, decomposedMatrix: MatrixMath.decomposeMatrix(styleToUse.transformMatrix)}
    //
    if (didChange) {
    ...

This is my first look at any of this code, so I'm very unsure how to go about fixing this for real. Any pointers?

davidstubbs avatar Nov 03 '15 15:11 davidstubbs

@astreet, have there been any recent changes to transform matrices? There seems to be an inconsistency with Android and iOS

ericvicenti avatar Nov 03 '15 17:11 ericvicenti

So a bit more research and...

The Android version relies on the scaleX/translateY/etc properties to get the transition.

A bunch of commits seemed to break that.

The problem is basically fixed already in https://github.com/facebook/react-native/commit/0ed3048e39c245f005b31277947606fa10f538da I applied that diff to my 0.13 install and it fixed the issue.

So this should be fixed in 0.14 already as long as all SceneConfigs use interpolators with fallbacks for transformTranslate. There seems to be a lot of transform related props changes going on, especially with android, so I'm backing away slowly...

davidstubbs avatar Nov 03 '15 17:11 davidstubbs

@kmagiera Were matrix transforms broken for a while in Android? I.e. possibly broken in the 0.13 release?

astreet avatar Nov 03 '15 19:11 astreet

This seems to be (kinda) fixed in master. Here's what happens on master,

2015-11-05 18_50_30

Notice the animation when I go back.

satya164 avatar Nov 05 '15 13:11 satya164

The animation while going back kind of hangs for me as well while navigating back. Works fine in IOS though.

sowdri avatar Nov 06 '15 00:11 sowdri

same here. the "back animation" is very choppy

qbig avatar Nov 06 '15 16:11 qbig

@dgladkov's patch #3954 is fixing this issue - merging it now and closing this. Thanks all for reporting and special thanks to @dgladkov for investigating and fixing the problem

kmagiera avatar Nov 09 '15 07:11 kmagiera