Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Uncaught TypeError: _this.refs.scrollView.scrollTo is not a function #539

Merged
merged 3 commits into from
Sep 11, 2017

Conversation

flyskywhy
Copy link
Contributor

@arribbar
Copy link
Collaborator

arribbar commented Sep 8, 2017

@flyskywhy Can you describe more what you intend to with this PR ?
I'll add some comments directly in your code as well.

@@ -432,7 +432,7 @@ export default class extends Component {
})

// trigger onScrollEnd manually in android
if (!animated || Platform.OS === 'android') {
if (!animated || Platform.OS !== 'ios') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why changing this line ?

@@ -419,10 +419,10 @@ export default class extends Component {
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[animated ? 'setPage' : 'setPageWithoutAnimation'](diff)
if (Platform.OS !== 'ios') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why changing this line ?

@flyskywhy
Copy link
Contributor Author

The reason of changing Platform.OS === 'android' to Platform.OS !== 'ios', is to match the logic of Platform.OS === 'ios' in renderScrollView(), then this react-native-swiper can be used with not just ios and android, but also windows and web described in exports.platforms = ['ios', 'android', 'windows', 'web']; of https://github.com/facebook/react-native/blob/0.44-stable/packager/defaults.js, for example, Platform.OS === 'web' in https://github.com/flyskywhy/react-web 😛

@arribbar arribbar merged commit ead66e5 into leecade:master Sep 11, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants