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.sheetItemContainer,
_styles.sheet _styles.sheet
] }> ] }>
<ScrollView { this._getWrappedContent() }
bounces = { false }
showsVerticalScrollIndicator = { false }>
{ this._getWrappedContent() }
</ScrollView>
</View> </View>
</View> </View>
</SlidingView> </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} * @returns {React$Element}
*/ */
_getWrappedContent() { _getWrappedContent() {
const content = (
<ScrollView
bounces = { false }
showsVerticalScrollIndicator = { false } >
{ this.props.children }
</ScrollView>
);
if (Platform.OS === 'ios') { if (Platform.OS === 'ios') {
const majorVersionIOS = parseInt(Platform.Version, 10); const majorVersionIOS = parseInt(Platform.Version, 10);
if (majorVersionIOS > 10) { if (majorVersionIOS > 10) {
return ( return (
<SafeAreaView> <SafeAreaView>
{ this.props.children } { content }
</SafeAreaView> </SafeAreaView>
); );
} }
} }
return this.props.children; return content;
} }
} }