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.horizontal;
|
||||
|
||||
const baseStyle = this.props.horizontal ? styles.baseHorizontal : styles.baseVertical;
|
||||
|
||||
const props = {
|
||||
...this.props,
|
||||
alwaysBounceHorizontal,
|
||||
alwaysBounceVertical,
|
||||
style: ([styles.base, this.props.style]: ?Array<any>),
|
||||
style: ([baseStyle, this.props.style]: ?Array<any>),
|
||||
onTouchStart: this.scrollResponderHandleTouchStart,
|
||||
onTouchMove: this.scrollResponderHandleTouchMove,
|
||||
onTouchEnd: this.scrollResponderHandleTouchEnd,
|
||||
|
@ -529,7 +531,7 @@ const ScrollView = React.createClass({
|
|||
return React.cloneElement(
|
||||
refreshControl,
|
||||
{style: props.style},
|
||||
<ScrollViewClass {...props} style={styles.base} ref={this._setScrollViewRef}>
|
||||
<ScrollViewClass {...props} style={baseStyle} ref={this._setScrollViewRef}>
|
||||
{contentContainer}
|
||||
</ScrollViewClass>
|
||||
);
|
||||
|
@ -544,11 +546,14 @@ const ScrollView = React.createClass({
|
|||
});
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
base: {
|
||||
baseVertical: {
|
||||
flex: 1,
|
||||
},
|
||||
baseHorizontal: {
|
||||
flex: 1,
|
||||
flexDirection: 'row',
|
||||
},
|
||||
contentContainerHorizontal: {
|
||||
alignSelf: 'flex-start',
|
||||
flexDirection: 'row',
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue