From 1a1ec3dd75378dbe3ad048dbb12c106b42f3b9c9 Mon Sep 17 00:00:00 2001 From: flochtililoch Date: Sun, 17 Apr 2022 16:40:49 -0700 Subject: [PATCH] fix: Bug with scrollbars on iOS 13+ Apply [suggested bug fix](https://github.com/facebook/react-native/issues/26610#issuecomment-539843444) for scrollbars sometime rendering off-centered --- src/components/hv-view/index.js | 6 ++++++ src/components/hv-view/types.js | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/components/hv-view/index.js b/src/components/hv-view/index.js index 1d1b9a366..d8a2aab40 100644 --- a/src/components/hv-view/index.js +++ b/src/components/hv-view/index.js @@ -114,6 +114,12 @@ export default class HvView extends PureComponent { 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; } diff --git a/src/components/hv-view/types.js b/src/components/hv-view/types.js index 29f3049b8..ab8a26127 100644 --- a/src/components/hv-view/types.js +++ b/src/components/hv-view/types.js @@ -26,5 +26,11 @@ export type InternalProps = {| style?: ?Array, testID?: ?string, children?: ?any, + scrollIndicatorInsets?: { + bottom?: number, + left?: number, + right?: number, + top?: number, + }, stickyHeaderIndices?: ?(number[]), |};