Add support for macOS legacy scroller system setting. #262
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please select one of the following
macOS scroll views are usually like iOS scroll views in that the scroll indicators only appear when scrolling and they overlay the content view. But in System Preferences > General, the user may choose 'Show scroll bars: Always' in which case the content view shrinks and a horizontal and/or vertical scroll indicator appears to the right and/or below the content view. In these cases the react-native content area was still being laid out as if the content view was the same size as the scroll view which would could cause the vertical scroll indicator to appear because the content was too wide.
This fix involves a change to the
RCTScrollContentView reactSetFrame:
method. When the react frame is being set, the method checks if thescrollerStyle
property on theNSScrollView
isNSScrollerStyleLegacy
. If so it gets the width and height of the scrollers if visible and adjusts the frame size.When the user changes the setting in System Preferences a
NSPreferredScrollerStyleDidChangeNotification
notification is sent. When this notification is sent, a react native event is fired to theonPreferredScrollerStyleDidChange
prop of<ScrollView>
. The javascript implementation ofScrollView
handles the event and forces a re-render.Focus areas to test
The RNTester app was used to validate the change with attention to the Scroll and List examples.
Microsoft Reviewers: Open in CodeFlow