Compare commits
3 Commits
bumpVersio
...
feature/an
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dcc2171c62 | ||
|
|
d15df1cb32 | ||
|
|
69376b9bd4 |
21
dist/index.js
vendored
21
dist/index.js
vendored
@ -153,7 +153,7 @@ module.exports = _react2.default.createClass({
|
||||
showsVerticalScrollIndicator: false,
|
||||
bounces: false,
|
||||
scrollsToTop: false,
|
||||
removeClippedSubviews: true,
|
||||
removeClippedSubviews: false,
|
||||
automaticallyAdjustContentInsets: false,
|
||||
showsPagination: true,
|
||||
showsButtons: false,
|
||||
@ -388,11 +388,7 @@ module.exports = _react2.default.createClass({
|
||||
if (state.dir === 'x') x = diff * state.width;
|
||||
if (state.dir === 'y') y = diff * state.height;
|
||||
|
||||
if (_reactNative.Platform.OS === 'android') {
|
||||
this.refs.scrollView && this.refs.scrollView.setPage(diff);
|
||||
} else {
|
||||
this.refs.scrollView && this.refs.scrollView.scrollTo({ x: x, y: y });
|
||||
}
|
||||
this.refs.scrollView && this.refs.scrollView.scrollTo({ x: x, y: y });
|
||||
|
||||
// update scroll state
|
||||
this.setState({
|
||||
@ -551,7 +547,7 @@ module.exports = _react2.default.createClass({
|
||||
);
|
||||
},
|
||||
renderScrollView: function renderScrollView(pages) {
|
||||
if (_reactNative.Platform.OS === 'ios') return _react2.default.createElement(
|
||||
return _react2.default.createElement(
|
||||
_reactNative.ScrollView,
|
||||
_extends({ ref: 'scrollView'
|
||||
}, this.props, this.scrollViewPropOverrides(), {
|
||||
@ -562,15 +558,6 @@ module.exports = _react2.default.createClass({
|
||||
onScrollEndDrag: this.onScrollEndDrag }),
|
||||
pages
|
||||
);
|
||||
return _react2.default.createElement(
|
||||
_reactNative.ViewPagerAndroid,
|
||||
_extends({ ref: 'scrollView'
|
||||
}, this.props, {
|
||||
initialPage: this.props.loop ? this.state.index + 1 : this.state.index,
|
||||
onPageSelected: this.onScrollEnd,
|
||||
style: { flex: 1 } }),
|
||||
pages
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@ -626,4 +613,4 @@ module.exports = _react2.default.createClass({
|
||||
this.props.showsButtons && this.renderButtons()
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
42
src/index.js
42
src/index.js
@ -141,7 +141,7 @@ module.exports = React.createClass({
|
||||
showsVerticalScrollIndicator : false,
|
||||
bounces : false,
|
||||
scrollsToTop : false,
|
||||
removeClippedSubviews : true,
|
||||
removeClippedSubviews : false,
|
||||
automaticallyAdjustContentInsets : false,
|
||||
showsPagination : true,
|
||||
showsButtons : false,
|
||||
@ -367,11 +367,7 @@ module.exports = React.createClass({
|
||||
if(state.dir === 'x') x = diff * state.width
|
||||
if(state.dir === 'y') y = diff * state.height
|
||||
|
||||
if (Platform.OS === 'android') {
|
||||
this.refs.scrollView && this.refs.scrollView.setPage(diff)
|
||||
} else {
|
||||
this.refs.scrollView && this.refs.scrollView.scrollTo({ x, y })
|
||||
}
|
||||
this.refs.scrollView && this.refs.scrollView.scrollTo({ x, y })
|
||||
|
||||
// update scroll state
|
||||
this.setState({
|
||||
@ -521,28 +517,18 @@ module.exports = React.createClass({
|
||||
},
|
||||
|
||||
renderScrollView(pages) {
|
||||
if (Platform.OS === 'ios')
|
||||
return (
|
||||
<ScrollView ref="scrollView"
|
||||
{...this.props}
|
||||
{...this.scrollViewPropOverrides()}
|
||||
contentContainerStyle={[styles.wrapper, this.props.style]}
|
||||
contentOffset={this.state.offset}
|
||||
onScrollBeginDrag={this.onScrollBegin}
|
||||
onMomentumScrollEnd={this.onScrollEnd}
|
||||
onScrollEndDrag={this.onScrollEndDrag}>
|
||||
{pages}
|
||||
</ScrollView>
|
||||
);
|
||||
return (
|
||||
<ViewPagerAndroid ref="scrollView"
|
||||
{...this.props}
|
||||
initialPage={this.props.loop ? this.state.index + 1 : this.state.index}
|
||||
onPageSelected={this.onScrollEnd}
|
||||
style={{flex: 1}}>
|
||||
{pages}
|
||||
</ViewPagerAndroid>
|
||||
);
|
||||
return (
|
||||
<ScrollView ref="scrollView"
|
||||
{...this.props}
|
||||
{...this.scrollViewPropOverrides()}
|
||||
contentContainerStyle={[styles.wrapper, this.props.style]}
|
||||
contentOffset={this.state.offset}
|
||||
onScrollBeginDrag={this.onScrollBegin}
|
||||
onMomentumScrollEnd={this.onScrollEnd}
|
||||
onScrollEndDrag={this.onScrollEndDrag}>
|
||||
{pages}
|
||||
</ScrollView>
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user