ScrollView - Respect the shows<Horizontal | Vertical>ScrollIndicator
props on macOS
#1135
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
Summary
React Native's ScrollView component defines two props for iOS and Android:
showsVerticalScrollIndicator
andshowsHorizontalScrollIndicator
. These are designed to be user overridable (I.E: the user could make a vertical scrolling list that never shows a vertical indicator). macOS has equivalent props:hasVerticalScroller
andhasVerticalScroller
, but we would set them ourselves in code and not respect the user choice. We can simplify our code and respect the user choice by removing bits where we manually set whether our scroll view has vertical and horizontal scrollers or not. I also setautoHidesScrollbars = true
to better match the existing behavior and because I think it's a better default to have.Changelog
[macOS] [Fixed] - ScrollView respects props showsVerticalScrollIndicator, showsHorizontalScrollIndicator
Test Plan
I tested various different configurations of Scrollbars, making use of the existing Scrollindicators test". One thing to note is that macOS has 2 types of scrollbars that you can switch between in user preferences:
I made sure that the proper margins are set so that the content view is sized appropriately based on which scrollbars are current. I also tested fixed size vs variable size scrollviews by locally hardcoding a size in RNTester.
Screen.Recording.2022-04-25.at.4.13.10.AM.mov