}/> }/> }/> }/> }/> }/>

How to use android back button in react-router-native v6

606 Views Asked by At
<SafeAreaView>
      <NativeRouter>
        <Routes>
          <Route path="/" element={<Main/>}/>
          <Route path="one" element={<One/>}/>
          <Route path="second" element={<Second/>}/>
        </Routes>
      </NativeRouter>
</SafeAreaView>

This is the router structure created using react-router-native. This app closes when you press the back button on Android.

Is it possible to make the app go to the previous router without exiting when the back button of the android hardware is pressed?

I found a function called useAndroidBackButton in react-router-native v6, but I don't know how to use it.

0

There are 0 best solutions below