Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable transition animation for a specific scene #2838

Closed
toinfinityandbeyond opened this issue Jan 29, 2018 · 5 comments
Closed

disable transition animation for a specific scene #2838

toinfinityandbeyond opened this issue Jan 29, 2018 · 5 comments

Comments

@toinfinityandbeyond
Copy link

toinfinityandbeyond commented Jan 29, 2018

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
@Blapi
Copy link
Collaborator

Blapi commented Jan 29, 2018

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

@Blapi Blapi closed this as completed Jan 29, 2018
@toinfinityandbeyond
Copy link
Author

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

@toinfinityandbeyond
Copy link
Author

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.

@Blapi
Copy link
Collaborator

Blapi commented Jan 30, 2018

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.

@toinfinityandbeyond
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants