Fix ScrollView to work correctly for new css-layout
Reviewed By: sahrens Differential Revision: D3367140 fbshipit-source-id: ea470f289c92ebca71543a9b9328a7a5ed6d572b
This commit is contained in:
parent
4391ef218b
commit
6603cef95c
|
@ -468,11 +468,13 @@ const ScrollView = React.createClass({
|
||||||
this.props.alwaysBounceVertical :
|
this.props.alwaysBounceVertical :
|
||||||
!this.props.horizontal;
|
!this.props.horizontal;
|
||||||
|
|
||||||
|
const baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
|
||||||
|
|
||||||
const props = {
|
const props = {
|
||||||
...this.props,
|
...this.props,
|
||||||
alwaysBounceHorizontal,
|
alwaysBounceHorizontal,
|
||||||
alwaysBounceVertical,
|
alwaysBounceVertical,
|
||||||
style: ([styles.base, this.props.style]: ?Array<any>),
|
style: ([baseStyle, this.props.style]: ?Array<any>),
|
||||||
onTouchStart: this.scrollResponderHandleTouchStart,
|
onTouchStart: this.scrollResponderHandleTouchStart,
|
||||||
onTouchMove: this.scrollResponderHandleTouchMove,
|
onTouchMove: this.scrollResponderHandleTouchMove,
|
||||||
onTouchEnd: this.scrollResponderHandleTouchEnd,
|
onTouchEnd: this.scrollResponderHandleTouchEnd,
|
||||||
|
@ -529,7 +531,7 @@ const ScrollView = React.createClass({
|
||||||
return React.cloneElement(
|
return React.cloneElement(
|
||||||
refreshControl,
|
refreshControl,
|
||||||
{style: props.style},
|
{style: props.style},
|
||||||
<ScrollViewClass {...props} style={styles.base} ref={this._setScrollViewRef}>
|
<ScrollViewClass {...props} style={baseStyle} ref={this._setScrollViewRef}>
|
||||||
{contentContainer}
|
{contentContainer}
|
||||||
</ScrollViewClass>
|
</ScrollViewClass>
|
||||||
);
|
);
|
||||||
|
@ -544,11 +546,14 @@ const ScrollView = React.createClass({
|
||||||
});
|
});
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
base: {
|
baseVertical: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
|
baseHorizontal: {
|
||||||
|
flex: 1,
|
||||||
|
flexDirection: 'row',
|
||||||
|
},
|
||||||
contentContainerHorizontal: {
|
contentContainerHorizontal: {
|
||||||
alignSelf: 'flex-start',
|
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue