From e1080d72d76ac6295869979e82ccf76cb7d39b2e Mon Sep 17 00:00:00 2001 From: Nicolas Gallagher Date: Tue, 6 Sep 2016 12:33:53 -0700 Subject: [PATCH] [fix] ScrollView style issues * Fix contentContainer not expanding to contain all child elements * Add momentum scrolling on iOS Fix #197 --- examples/components/ScrollView/ScrollViewExample.js | 1 + src/apis/StyleSheet/StyleSheetValidation.js | 3 ++- src/components/ScrollView/index.js | 6 ++++-- src/components/View/ViewStylePropTypes.js | 3 ++- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/components/ScrollView/ScrollViewExample.js b/examples/components/ScrollView/ScrollViewExample.js index fb20339d..d56726a6 100644 --- a/examples/components/ScrollView/ScrollViewExample.js +++ b/examples/components/ScrollView/ScrollViewExample.js @@ -52,6 +52,7 @@ const styles = StyleSheet.create({ borderWidth: '1px' }, scrollViewContentContainerStyle: { + backgroundColor: '#eee', padding: '10px' } }) diff --git a/src/apis/StyleSheet/StyleSheetValidation.js b/src/apis/StyleSheet/StyleSheetValidation.js index bb703ade..a27a2715 100644 --- a/src/apis/StyleSheet/StyleSheetValidation.js +++ b/src/apis/StyleSheet/StyleSheetValidation.js @@ -74,7 +74,8 @@ StyleSheetValidation.addValidStylePropTypes({ display: PropTypes.string, float: PropTypes.oneOf([ 'left', 'none', 'right' ]), font: PropTypes.string, /* @private */ - listStyle: PropTypes.string + listStyle: PropTypes.string, + WebkitOverflowScrolling: PropTypes.string /* @private */ }) module.exports = StyleSheetValidation diff --git a/src/components/ScrollView/index.js b/src/components/ScrollView/index.js index ce6df299..7a82be6a 100644 --- a/src/components/ScrollView/index.js +++ b/src/components/ScrollView/index.js @@ -222,14 +222,16 @@ const styles = StyleSheet.create({ base: { flex: 1, overflowX: 'hidden', - overflowY: 'auto' + overflowY: 'auto', + WebkitOverflowScrolling: 'touch' }, baseHorizontal: { + flexDirection: 'row', overflowX: 'auto', overflowY: 'hidden' }, contentContainer: { - flex: 1 + flexGrow: 1 }, contentContainerHorizontal: { flexDirection: 'row' diff --git a/src/components/View/ViewStylePropTypes.js b/src/components/View/ViewStylePropTypes.js index 61f1b9a1..630c515c 100644 --- a/src/components/View/ViewStylePropTypes.js +++ b/src/components/View/ViewStylePropTypes.js @@ -16,6 +16,7 @@ module.exports = { backgroundColor: ColorPropType, opacity: number, overflow: autoOrHiddenOrVisible, + zIndex: number, /* * @platform web */ @@ -34,5 +35,5 @@ module.exports = { transition: string, userSelect: string, visibility: hiddenOrVisible, - zIndex: number + WebkitOverflowScrolling: oneOf([ 'auto', 'touch' ]) };