-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix useScrollToTop not working when nesting multiple tab navigators #11063
Fix useScrollToTop not working when nesting multiple tab navigators #11063
Conversation
Hey anthonyguay! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines. |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
Hey autofix-ci[bot]! Thanks for opening your first pull request in this repo. If you haven't already, make sure to read our contribution guidelines. |
Codecov ReportBase: 74.29% // Head: 74.17% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #11063 +/- ##
==========================================
- Coverage 74.29% 74.17% -0.12%
==========================================
Files 176 176
Lines 5578 5587 +9
Branches 2182 2186 +4
==========================================
Hits 4144 4144
- Misses 1385 1394 +9
Partials 49 49
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Looks like TS is failing. Can you fix the errors?
…croll-when-multiple-tab-navigators
@anthonyguay thanks for getting this is main. We'll finally be able to remove our patch 👍 |
Hey! This issue is closed and isn't watched by the core team. You are welcome to discuss the issue with others in this thread, but if you think this issue is still valid and needs to be tracked, please open a new issue with a repro. |
…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>
…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>
All thanks to you @Gregoirevda ! We're also going to be able to remove the patch 👍 |
…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>
…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>
…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>
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 by @iirovi, and a pull request to fix the issue has been proposed by @Gregoirevda here. Recent changes on main automatically closed the pull request, so I'm posting his solution here again at @satya164's request.
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.
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.
Untitled.mp4