infinitered / ignite-bowser

Bowser is now re-integrated into Ignite CLI! Head to https://github.com/infinitered/ignite to check it out.
https://infinite.red/ignite
MIT License
615 stars 140 forks source link

Navigating from mobx-state-tree model actions #385

Closed tmaly1980 closed 3 years ago

tmaly1980 commented 3 years ago

How would I go about triggering navigation changes from within model actions in mobx-state-tree? In ignite-andross (and react-navigation v3), it was possible to change the state from a saga.

What I'd like to do is navigate to a new screen based upon data being altered in the mobx state tree.

carlosa54 commented 3 years ago

Hi @tmaly1980 , there's no docs for it but you can use the RootNavigation initialized in app.tsx, importing it in your model and calling RootNavigation.navigate("the_screen")

You can take a look at how it's being used here https://github.com/infinitered/ignite-bowser/blob/686fabe41ee9fda7025f4751b3cce36cae89521f/boilerplate/app/services/reactotron/reactotron.ts.ejs#L164

bryanstearns commented 3 years ago

Hi @tmaly1980 - great question! Hi @carlosa54 - great answer!

I'm going to close this since it's not really a Bowser issue. A better place to ask questions like this is the Infinite Red Slack Community - come join us!