fix BottomSheet shaking

This commit is contained in:
Bettenbuk Zoltan 2019-10-11 12:04:36 +02:00 committed by Zoltan Bettenbuk
parent 99de9d0bfa
commit 245eb89b85
1 changed files with 12 additions and 8 deletions

View File

@ -61,11 +61,7 @@ class BottomSheet extends PureComponent<Props> {
styles.sheetItemContainer,
_styles.sheet
] }>
<ScrollView
bounces = { false }
showsVerticalScrollIndicator = { false }>
{ this._getWrappedContent() }
</ScrollView>
</View>
</View>
</SlidingView>
@ -73,24 +69,32 @@ class BottomSheet extends PureComponent<Props> {
}
/**
* Wraps the content when needed (iOS 11 and above), or just returns the original children.
* Wraps the content when needed (iOS 11 and above), or just returns the original content.
*
* @returns {React$Element}
*/
_getWrappedContent() {
const content = (
<ScrollView
bounces = { false }
showsVerticalScrollIndicator = { false } >
{ this.props.children }
</ScrollView>
);
if (Platform.OS === 'ios') {
const majorVersionIOS = parseInt(Platform.Version, 10);
if (majorVersionIOS > 10) {
return (
<SafeAreaView>
{ this.props.children }
{ content }
</SafeAreaView>
);
}
}
return this.props.children;
return content;
}
}