Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make useScrollToTop work when nesting multiple tab navigators (#…
…11063) **Motivation** This PR answers this open issue: #11045 When tapping on a bottom tab, the screen scrolls back to the top. However, when adding a second tab navigator at the top of the screen, tapping the bottom tap does not automatically scroll to top anymore. Only tapping the top navigation tab will scroll the screen up. It is expected that the bottom tab tap will still scroll the screen to the top, just like tapping the status bar. **Context** This issue has previously been reported [here](#8586) by [@iirovi](https://github.com/iirovi), and a pull request to fix the issue has been proposed by [@Gregoirevda](https://github.com/Gregoirevda) [here](#9434). Recent changes on main automatically closed the pull request, so I'm posting his solution here again at @satya164's [request](#9434 (comment)). We tested this solution on our app and it works perfectly well. Previously, tapping the bottom tab would not scroll back to the top when a top tab bar was present, but this fixes the issue. You can find the package versions in [the open issue](#11045). **Behavior example** Twitter has both top and bottom navigation bars. When tapping on the bottom tap, the screen scrolls back to the top. Tapping the top tab also scroll to the top. <img src="https://user-images.githubusercontent.com/4307396/205150557-64787dfc-ed77-4a2f-88f3-205b05b6aead.mp4" width="300"> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
- Loading branch information