React-native-navigation: [V2] Can't disable animation when setStackRoot

Created on 4 Jul 2018  路  5Comments  路  Source: wix/react-native-navigation

Issue Description

setStackRoot without animation dosen't work.

Navigation.setStackRoot(this.props.componentId, {
        component: {
          name: 'mainScreen',
        },
        options: {
          animated: false
        }
      });

Have also tried

Navigation.setStackRoot(this.props.componentId, {
        component: {
          name: 'mainScreen',
        },
        options: {
          animation: {
            push: {  // also tried setStackRoot
              enable: false
            }
          }
        }
      });

Environment

  • React Native Navigation version: ^2.0.2394
  • React Native version: 0.55.4
  • Platform(s) (iOS, Android, or both?): IOS
  • Device info (Simulator/Device? OS version? Debug/Release?): Simulator

All 5 comments

Try this:

Navigation.setStackRoot(this.props.componentId, {
        component: {
          name: 'mainScreen',
          options: {
            animations: {
              push: {  // also tried setStackRoot
                enable: false
              }
            }
          }
        }
      });

@yogevbd I've tried your suggestion but it still doesn't work.

Oh I had a syntax error, changed animation to animations. can you please try again?

That worked! Thank you!

For anyone else for whom the above is not clear...

I was still struggling with disabling what looked like a push animation when calling setStackRoot with the above example. I was able to disable the animation when using the setStackRoot option in animations

Navigation.setStackRoot('Example', {
    component: {
      name: 'your_screen_name',
      options: {
        animations: {
          setStackRoot: { enabled: false },
        },
      },
    },
  })

...as seen here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nbolender picture nbolender  路  3Comments

bjacog picture bjacog  路  3Comments

yedidyak picture yedidyak  路  3Comments

viper4595 picture viper4595  路  3Comments

henrikra picture henrikra  路  3Comments