IjzerenHein / react-navigation-magic-move

Bindings for using react-navigation with react-native-magic-move 🐰🎩✨
MIT License
136 stars 5 forks source link

Get Invariant Violation: withNavigation can only be used on a view hierarchy of a navigator. #1

Closed mregan59 closed 5 years ago

mregan59 commented 5 years ago

I'm trying to get this snack that uses this with react-native-router-flux to work: https://snack.expo.io/@mern59/react-native-magic-move-copy but I keep getting that error on the initial load.

Screen Shot 2019-03-12 at 10 00 54 PM

I have a project of my own that is using react-native-router-flux that I was trying to use this on that is also experiencing this error: https://snack.expo.io/@mern59/animation:-flowers-new. On mine I don't get the error initially but as soon as I try to navigate it shows. If I remove import "react-navigation-magic-move" it works but I would like to use it so I can have animation on the back button.

IjzerenHein commented 5 years ago

Hmm, the code for this lib is very slim and not much can go wrong tbh. It uses NavigationEvents from react-navigation to monitor the navigation state. Is it possible that you are using a MagicMove.Scene outside the navigation hierarchy?