I have built my expo app using expo-router. When I click a universal link (e.g. https://www.example.com/tabs/books/978123123645
) it opens the app and takes me to the correct screen, namely the details page for a book with ISBN 978123123645.
The back button on my book details page uses router.back() to take me back to tabs/books
. However, when I open this screen from a universal link, the back button takes me to tabs/profile
.
How should I route the back button so that it handles both scenarios correctly? In both cases, I want it to take me to tabs/books