Skip to content

Commit

Permalink
fix: Bug with scrollbars on iOS 13+
Browse files Browse the repository at this point in the history
Apply [suggested bug fix](facebook/react-native#26610 (comment)) for scrollbars sometime rendering off-centered
  • Loading branch information
flochtililoch committed Apr 17, 2022
1 parent 3b816f8 commit 1a1ec3d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/components/hv-view/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ export default class HvView extends PureComponent<HvComponentProps> {
props.showsHorizontalScrollIndicator = horizontal && showScrollIndicator;
props.showsVerticalScrollIndicator = !horizontal && showScrollIndicator;

// Fix scrollbar rendering issue in iOS 13+
// https://github.com/facebook/react-native/issues/26610#issuecomment-539843444
if (Platform.OS === 'ios' && parseInt(Platform.Version, 10) >= 13) {
props.scrollIndicatorInsets = { right: 1 };
}

if (horizontal) {
props.horizontal = true;
}
Expand Down
6 changes: 6 additions & 0 deletions src/components/hv-view/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@ export type InternalProps = {|
style?: ?Array<StyleSheet>,
testID?: ?string,
children?: ?any,
scrollIndicatorInsets?: {
bottom?: number,
left?: number,
right?: number,
top?: number,
},
stickyHeaderIndices?: ?(number[]),
|};

0 comments on commit 1a1ec3d

Please sign in to comment.