@@ -44,6 +44,10 @@ const ScrollView = createReactClass({
44
44
return this . scrollResponderMixinGetInitialState ( ) ;
45
45
} ,
46
46
47
+ flashScrollIndicators ( ) {
48
+ this . scrollResponderFlashScrollIndicators ( ) ;
49
+ } ,
50
+
47
51
setNativeProps ( props : Object ) {
48
52
if ( this . _scrollViewRef ) {
49
53
this . _scrollViewRef . setNativeProps ( props ) ;
@@ -169,9 +173,11 @@ const ScrollView = createReactClass({
169
173
/>
170
174
) ;
171
175
176
+ const baseStyle = horizontal ? styles . baseHorizontal : styles . baseVertical ;
177
+
172
178
const props = {
173
179
...other ,
174
- style : [ styles . base , horizontal && styles . baseHorizontal , this . props . style ] ,
180
+ style : [ baseStyle , this . props . style ] ,
175
181
onTouchStart : this . scrollResponderHandleTouchStart ,
176
182
onTouchMove : this . scrollResponderHandleTouchMove ,
177
183
onTouchEnd : this . scrollResponderHandleTouchEnd ,
@@ -198,7 +204,7 @@ const ScrollView = createReactClass({
198
204
return React . cloneElement (
199
205
refreshControl ,
200
206
{ style : props . style } ,
201
- < ScrollViewClass { ...props } ref = { this . _setScrollViewRef } style = { styles . base } >
207
+ < ScrollViewClass { ...props } ref = { this . _setScrollViewRef } style = { baseStyle } >
202
208
{ contentContainer }
203
209
</ ScrollViewClass >
204
210
) ;
@@ -245,21 +251,32 @@ const ScrollView = createReactClass({
245
251
}
246
252
} ) ;
247
253
254
+ const commonStyle = {
255
+ flexGrow : 1 ,
256
+ flexShrink : 1 ,
257
+ overscrollBehavior : 'contain' ,
258
+ // Enable hardware compositing in modern browsers.
259
+ // Creates a new layer with its own backing surface that can significantly
260
+ // improve scroll performance.
261
+ transform : [ { translateZ : 0 } ] ,
262
+ // iOS native scrolling
263
+ WebkitOverflowScrolling : 'touch'
264
+ } ;
265
+
248
266
const styles = StyleSheet . create ( {
249
- base : {
250
- flex : 1 ,
267
+ baseVertical : {
268
+ ...commonStyle ,
269
+ flexDirection : 'column' ,
251
270
overflowX : 'hidden' ,
252
271
overflowY : 'auto' ,
253
- WebkitOverflowScrolling : 'touch' ,
254
- // Enable hardware compositing in modern browsers.
255
- // Creates a new layer with its own backing surface that can significantly
256
- // improve scroll performance.
257
- transform : [ { translateZ : 0 } ]
272
+ touchAction : 'pan-y'
258
273
} ,
259
274
baseHorizontal : {
275
+ ...commonStyle ,
260
276
flexDirection : 'row' ,
261
277
overflowX : 'auto' ,
262
- overflowY : 'hidden'
278
+ overflowY : 'hidden' ,
279
+ touchAction : 'pan-x'
263
280
} ,
264
281
contentContainerHorizontal : {
265
282
flexDirection : 'row'
0 commit comments