React-native-router-flux: disable transition animation for a specific scene

Created on 29 Jan 2018  路  5Comments  路  Source: aksonov/react-native-router-flux

Version

Tell us which versions you are using:

  • react-native-router-flux v4.0.0-beta.24
  • react-native v0.50.4

Expected behaviour

Duration to 0 on scene should remove transition animation

Actual behaviour

With duration={0} nothing happens. I also tried with transitionConfig on the desired scene, but it only works when it is on the root scene.

I want to disable transition animation but only for a specific scene, not all of them.
I tried to search some fix and found #2628 but, when it pops, it applies all the transitions of all the scenes I passed through, I mean, if I did Login -> Scene1 -> Scene2 then it will apply Transition from Login-> Transition from Scene 1 -> Transition from Scene 2, instead just one which it is what I want.

Steps to reproduce

  1. Just put duration={0} or transitionConfig on a scene and it won't work

Most helpful comment

Reviewing my navigation stack, I managed to resolve it at last. It looks like there was something wrong on the way I was nesting my scenes. Anyway I had to put it on my root scene, but at least now works and doesn't look weird.
Thank you so much for your attention @Blapi

All 5 comments

In your transitionConfig, apply CardStackStyleInterpolator.forInitial to the Scenes where you don't want a transition animation

That doesn't resolve my issue :/ @Blapi Like I said before, it only works transitionConfig on the root scene...

I tried this solution from #2628
<Stack key='root' hideNavBar transitionConfig={() => ({ screenInterpolator: (props) => { const { scene } = props switch (scene.route.routeName) { /* case yourKeyScene: return theAnimationYouWant(props)*/ case 'groups': return CardStackStyleInterpolator.forVertical(props) case 'home': return CardStackStyleInterpolator.forHorizontal(props) case 'inbox': return CardStackStyleInterpolator.forFade(props) default: return CardStackStyleInterpolator.forInitial } } })}>

But like I said, it works ok when you do push, but when it does pop it makes all the transitions from all scenes you passed through ... and it looks weird.

If there is not transition in push, there will be no transition in pop.
When I gave you the solution, it was working for me as you may expect, and it still works now after testing.

Show me your transitionConfig and the steps of your navigation.

Reviewing my navigation stack, I managed to resolve it at last. It looks like there was something wrong on the way I was nesting my scenes. Anyway I had to put it on my root scene, but at least now works and doesn't look weird.
Thank you so much for your attention @Blapi

Was this page helpful?
0 / 5 - 0 ratings

Related issues

llgoer picture llgoer  路  3Comments

basdvries picture basdvries  路  3Comments

maphongba008 picture maphongba008  路  3Comments

jgibbons picture jgibbons  路  3Comments

moaxaca picture moaxaca  路  3Comments