From b885a41a47b60fb1988f8f486247745cd5615cd3 Mon Sep 17 00:00:00 2001 From: German Stuarts Date: Thu, 31 Aug 2017 12:21:58 -0300 Subject: [PATCH 1/2] initState width and height assign changed because on mount either width and height are calculated, but if you left the view and then come back, those width and height previously calculated are not used and it uses width and height of window instead --- src/index.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 743cccdd..ee7e6dfc 100644 --- a/src/index.js +++ b/src/index.js @@ -222,8 +222,21 @@ export default class extends Component { // Default: horizontal initState.dir = props.horizontal === false ? 'y' : 'x' - initState.width = props.width || width - initState.height = props.height || height + if (props.width) { + initState.width = props.width + } else if (this.state && this.state.width){ + initState.width = this.state.width + } else { + initState.width = width; + } + + if (props.height) { + initState.height = props.height + } else if (this.state && this.state.height){ + initState.height = this.state.height + } else { + initState.height = height; + } this.internals = { ...this.internals, From dfa500ebacbcb78e59f6814d8bd3819fc11ec893 Mon Sep 17 00:00:00 2001 From: German Stuarts Date: Thu, 31 Aug 2017 12:33:54 -0300 Subject: [PATCH 2/2] allow setting style for ScrollView on iOS --- src/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index ee7e6dfc..ada03a72 100644 --- a/src/index.js +++ b/src/index.js @@ -116,6 +116,10 @@ export default class extends Component { PropTypes.object, PropTypes.number, ]), + scrollViewStyle: PropTypes.oneOfType([ + PropTypes.object, + PropTypes.number, + ]), pagingEnabled: PropTypes.bool, showsHorizontalScrollIndicator: PropTypes.bool, showsVerticalScrollIndicator: PropTypes.bool, @@ -593,7 +597,8 @@ export default class extends Component { contentOffset={this.state.offset} onScrollBeginDrag={this.onScrollBegin} onMomentumScrollEnd={this.onScrollEnd} - onScrollEndDrag={this.onScrollEndDrag}> + onScrollEndDrag={this.onScrollEndDrag} + style={this.props.scrollViewStyle}> {pages} )