grahammendick / navigation

Scene-Based Navigation for React and React Native
https://grahammendick.github.io/navigation/
Apache License 2.0
590 stars 41 forks source link

Support for Fast Refresh? #304

Closed drewhamlett closed 5 years ago

drewhamlett commented 5 years ago

First of all thanks for this library! This is really the only sane solution for navigation on mobile. Is there any chance of supporting fast refresh in the future. It seems to work with react navigation and react native navigation.

https://facebook.github.io/react-native/blog/2019/09/18/version-0.61

Thanks!

grahammendick commented 5 years ago

It’s great to hear that you like the Navigation router and thanks for getting in touch! Please let me know what’s missing from the Navigation router’s support for fast refresh

drewhamlett commented 5 years ago

I'm not too sure what would be missing. 🤔 By default it supports hot reloading of react hooks. Like useState and useReducer. react native navigation and react navigation seem to work. I'm not sure why though. I haven't found any commits on their side that mention Fast Refresh. It seem instead of doing a fast refresh it reloads the whole app.

drewhamlett commented 5 years ago

This is working! Did some more testing.

Make sure renderScene is rendering a React component and not an inline component.

home.renderScene = () => <Main />

not

home.renderScene = () => <View><Text>Hello</Text></View>

Which makes sense. And entry point of app needs to be like this

const App = () => // the app
export default App

Couldn't make other ways of exporting work

grahammendick commented 5 years ago

Great news. Thanks for letting me know

grahammendick commented 4 years ago

Thanks @drewhamlett I've changed the export in the Setup guide