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

[V2][Android] The transition animation of pop not working

Open linchCN opened this issue 8 years ago • 11 comments

Issue Description

The "x" transition animation of pop not work ,but push is OK.

Steps to Reproduce / Code Snippets / Screenshots

Navigation.setDefaultOptions({
                topBar: {
                    visible: false,
                    drawBehind: true,
                    animate: false
                },
                statusBar: {
                    drawBehind: true,
                    backgroundColor: "transparent",
                    style: 'dark'
                },
                animations: {
                    push: {
                        waitForRender: false,
                    }
                },
                animations: {
                    push: {
                        content: {
                            x: {
                                from: 1000,
                                to: 0,
                                duration: 500,
                                interpolation: 'accelerate',
                            },
                            alpha: {
                                from: 0,
                                to: 1,
                                duration: 500,
                                interpolation: 'accelerate'
                            }
                        },

                    },
                    pop: {
                        content: {
                            x: {
                                from: 0,
                                to: 1000,
                                duration: 500,
                                interpolation: 'decelerate',
                            },
                            alpha: {
                                from: 1,
                                to: 0,
                                duration: 500,
                                interpolation: 'decelerate'
                            }
                        }
                    }
                }
            });



Environment

  • React Native Navigation version: 2.0.2456
  • React Native version: 0.56.0
  • Platform(s) (iOS, Android, or both?): Android
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator

linchCN avatar Aug 06 '18 07:08 linchCN

I found that, the pop animation does work in a non-tab based app. But not in a tab based app.

starzle avatar Aug 26 '18 21:08 starzle

@linchenhuicn Does the fade animation work?

guyca avatar Aug 27 '18 06:08 guyca

@guyca the fade does not work either

makirby avatar Sep 14 '18 12:09 makirby

Also seeing this on Android with version 2.0.2556

jordanfloyd avatar Oct 08 '18 14:10 jordanfloyd

Yes it is not working by setting pop animations via

  Navigation.setDefaultOptions(defaultOptions);

but when i set animation with each push screen component it works

So the thing that work for me is

Set push animations via defaultOptions

  Navigation.setDefaultOptions({animations:screenPushAnimations} );

and pop animations via each push screen component

options:{
        topBar:{
          ...transparentTopBar,  
          animations: screenPopAnimations
      }

and animation used are

 const screenPushAnimations = {
      push:{
        content: {
          x: {
            from:1000,
            to: 0,
            duration:200,
            interpolation:'accelerate'
          }
        }
      }      
    }


 const screenPopAnimations = {
      pop:{
        content: {
          x: {
            from: 0,
            to: 1000,
            duration:200,
            interpolation:'accelerate'
          }
        }
      }      
    }

Note that you have to add popAnimation with the rootComponent also set via Navigation.setRoot(component)

as without it the first screen in stack will not have the desired effect

HarishJangra avatar Oct 11 '18 09:10 HarishJangra

@HarishJangra awesome, which version of RNN are you using?

makirby avatar Oct 11 '18 11:10 makirby

    "react-native-navigation": "^2.0.2575",
    "react-native": "^0.56.1",

HarishJangra avatar Oct 12 '18 05:10 HarishJangra

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Nov 26 '18 12:11 stale[bot]

I have a similar issue when I pop a screen with a custom animation (tested only with alpha), causing some weird flash between the two screens.

LRNZ09 avatar Nov 26 '18 16:11 LRNZ09

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you believe the issue is still relevant, please test on the latest Detox and report back. Thank you for your contributions.

stale[bot] avatar Dec 26 '18 20:12 stale[bot]

The issue has been closed for inactivity.

stale[bot] avatar Jan 04 '19 00:01 stale[bot]