-
Notifications
You must be signed in to change notification settings - Fork 45
No animation when using react-navigation SwitchNavigator #2
Comments
Alright, I will take a closer look at this shortly. Looking at the code and the error you are getting, I think it is related to the FAB component. I haven't tested very extensively with wrapping other components yet, but it might have some trouble with the |
Yes, I will do this in one hour, when I'm back home. |
Ok, wrapped the FAB's TouchableWithoutFeedback in a View and nothing changed. Still, it navigates but without any animations (SwitchNavigator) |
Could you try setting the |
collabsed={false} gives no effect, you probably meant collapsable={false} (InteliiSense) and it makes the FAB dont work... no animation nor navigation |
btw I'm going to leave Expo and React Navigation (after months of messing with it) and go for Wix Navigation... |
Yes that's what I meant |
Yep, Wix navigation is also pretty cool. I used it in a project a while back and it worked well. The only thing was that the API was marked as "experimental" for a really long time which sucked. I haven't worked with |
This isn't specific to the FAB. PS. Nice lib!
|
Alright cool, thanks for that example @Johan-dutoit ! 👍 I'm gonna take a look and see what's going on there |
Hi, I've investigated the problem and I understand what's going on now. Magic-move can only animate when both Scenes are mounted at any given time (the previous scene needs to be mounted when the new scene is mounted/activated). Unfortunately, the SwitchNavigator, unmounts the old scene before mounting the new scene. Here's a transcript of what's going on:
I currently don't have a solution for this., but I'm gonna give it some more thought. A solution could be a custom SwitchNavigator that keeps the old scene briefly mounted and shows the new scene on top. |
Glad you figured out the underlying problem @IjzerenHein! I don't have this issue myself, as I use the switch navigators differently, which is to create different flows in the app (for a lack of a better terminology), i.e. Onboarding flow vs login flow vs auth'd flow. So I'm not entirely convinced this needs to be supported. Let me know if you need a hand. |
Hey Johan, yes I'd love a hand 😄 I'm not sure if it's an easy fix though. It would largely depend on how complex the SwitchNavigator is. The goal here would be to make sure the old scene is still mounted at the time the new scene is mounted. I can imagine having a custom SwitchNavigator in cheers, Hein |
It's possible to have animations on SwitchNavigator |
Hi! Love this library!
But I'm having problems morphing one element into another when elements are on separate stacks / switch navigators.
All the examples are in react-native-router-flux which I'm totally unfamiliar with.
could you make some very simple examples in plain react-navigation v3 where elements are on separate stacks?
I'll show it exactly:
this is App.js
Navigation
StackOne ( FAB that is going to morph to a View with flex: 1 on a StackTwo
StackTwo
And the FAB element is:
What happens?
So I'm on StackOne and I click the FAB and it navigates me to a StackTwo properly, no errors, but also no animation. No effect.
I tried to do the same but instead of Switch navigator I used a StackNavigator, like this:
and even worse - got error that measureLayout is not a function, both ways (StackOne -> StackTwo and when going back).
// edit, more specifically:
component.getRef().measureLayout is not a function. (In 'component.getRef().measureLayout((0, _reactNative.findNodeHandle)(sceneRef), onSuccess, onFail)', 'component.getRef().measureLayout' is undefined)
What am I missing?
The text was updated successfully, but these errors were encountered: