-
Notifications
You must be signed in to change notification settings - Fork 149
Add ScrollView Indicator Overlay style #1658
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
Add ScrollView Indicator Overlay style #1658
Conversation
This PR would allow you to override the system preference and set your own default? @chiuam sounds useful 😅 |
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.
Code analysis results:
eslint
found some issues. Runyarn lint --fix
to automatically fix problems.
This does allow user to override the system preference and always have overlay style enabled. CleanShot.2023-01-17.at.16.37.02.mp4 |
Summary: ## Sync OS changes for ScrollBar [[ScrollView] Don't always adjust content view padding for both scrollers microsoft#1132](microsoft#1132) [ScrollView - Respect the shows<Horizontal | Vertical>ScrollIndicator props on macOS microsoft#1135](microsoft#1135) [Remove horizontal scrollview indicator padding when empty microsoft#1635](microsoft#1635) [Add ScrollView Indicator Overlay style microsoft#1658](microsoft#1658) NOTE: This will override the "Always" user setting and force the scrollview to use the overlay style instead {F850963270} Test Plan: |ScrollView Overlay Style| |https://pxl.cl/2qp0D| |ScrollView works correctly| |https://pxl.cl/2qpd1| Reviewers: chpurrer, lefever Reviewed By: chpurrer Differential Revision: https://phabricator.intern.facebook.com/D42637723
Summary: ## Sync OS changes for ScrollBar [[ScrollView] Don't always adjust content view padding for both scrollers microsoft#1132](microsoft#1132) [ScrollView - Respect the shows<Horizontal | Vertical>ScrollIndicator props on macOS microsoft#1135](microsoft#1135) [Remove horizontal scrollview indicator padding when empty microsoft#1635](microsoft#1635) [Add ScrollView Indicator Overlay style microsoft#1658](microsoft#1658) NOTE: This will override the "Always" user setting and force the scrollview to use the overlay style instead {F850963270} Test Plan: |ScrollView Overlay Style| |https://pxl.cl/2qp0D| |ScrollView works correctly| |https://pxl.cl/2qpd1| Reviewers: chpurrer, lefever Reviewed By: chpurrer Subscribers: generatedunixname89002005327315 Differential Revision: https://phabricator.intern.facebook.com/D42637723
Summary: **Context** - Issue reported here: https://fb.workplace.com/groups/647800172811209/permalink/1422946668629885/ - D43292504 synced [changes from OSS](microsoft#1658) where we added support for always showing the scroll indicator as overlay, even when the system setting was "always". - When the system settings were changed, the [preferredScrollerStyleDidChange](https://www.internalfb.com/code/fbsource/[c827f358997c]/third-party/microsoft-fork-of-react-native/react-native-macos/packages/react-native/React/Views/ScrollView/RCTScrollView.m?lines=1348-1351) notification was overriding the `scrollView.scrollerStyle` back to `NSScrollerStyleLegacy` - The issue was that we were only setting the overlay style on the underlying scrollView, but never saving it to the RCTScrollView. As a result, there was no reliable way to determine whether the overlay style had been saved or not. https://www.internalfb.com/code/fbsource/[c827f358997c70a3c49f80c55915c28bdab9b97f][history]/third-party/microsoft-fork-of-react-native/react-native-macos/packages/react-native/React/Views/ScrollView/RCTScrollView.m?lines=549-556 **Change** - Ensure that the overlay style indicator setting is saved to the `RCTScrollView` - If `hasOverlayStyleIndicator` is true, manually set the scrollview to `NSScrollerStyleOverlay` and override the system setting Test Plan: |Paper| | https://pxl.cl/4d7DN| Reviewers: chpurrer, lefever, #rn-desktop Reviewed By: chpurrer Differential Revision: https://phabricator.intern.facebook.com/D53027993
Please select one of the following
Summary
NSScrollView can have overlay style explicitly set.
https://developer.apple.com/documentation/appkit/nsscrollerstyle/nsscrollerstyleoverlay
Overlay style will not take up any space in the ContentView so content can be flush with insets.
Default uses the legacy style, not the overlay.
Changelog
[macOS] [ADDED] - Add ScrollView Indicator Overlay style
Test Plan
Overlay style can be enable/disabled
CleanShot.2023-01-17.at.15.34.10.mp4