Search code examples
androidreact-nativeexpoexpo-router

how to make expo router keep the same page after devmode fast refresh


When we change something when using the expo router, the expo GO android app auto-refresh feature will redirect us to the first page. How can we make it keep the same route we were working on?


Solution

  • Here is my finding after spending hours. if your components are in lower case it will send you back to initial screen. Using Pascal for naming Components will fix the issue. Basically first character of the component should be in Upper case.

    so instead of using

    const home = () => {
      return (
        <View>
          <Text>Home</Text>
        </View>
      )
    }
    export default home
    

    use this

    const Home = () => {
      return (
        <View>
          <Text>Home</Text>
        </View>
      )
    }
    export default Home
    

    let me know if this works for you too.