Skip to content

Conversation

@gmlion
Copy link

@gmlion gmlion commented Jan 23, 2017

In componentDidMount() of index.js, using a timeout resolves a problem
with scrollView.scrollTo() not working

In componentDidMount() of index.js, using a timeout resolves a problem
with scrollView.scrollTo() not working
@skv-headless
Copy link
Collaborator

Why did you change other lines? Here https://facebook.github.io/react-native/docs/timers.html is written that better to use setTimeout with timer mixin.

@gmlion
Copy link
Author

gmlion commented Jan 23, 2017

I didn't, it's only automatic formatting...sorry for the noise

@skv-headless
Copy link
Collaborator

@gmlion could you please update PR?

index.js Outdated
InteractionManager.runAfterInteractions(() => {
setTimeout(() => {
if (this.scrollView && Platform.OS === 'android') {
console.log("Scrolling to " + this.props.initialPage + " with containerWidth " + this.state.containerWidth);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove console.log

index.js Outdated

componentDidMount() {
InteractionManager.runAfterInteractions(() => {
setTimeout(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use this.setTimeout like in documentation

@skv-headless
Copy link
Collaborator

@gmlion I dont know what is working setTimeout or IntreractionManager. Can you please leave both to be sure.

@gmlion
Copy link
Author

gmlion commented Jan 30, 2017

Upon further testing, I found InteractionManager alone working on development configuration, but I still need setTimeout for the release configuration. I'm doing a commit with both anyway.

Also, I have found the setTimeout initially on stackoverflow, but I see it's mentioned also here (albeit for a slightly different problem I think) #366, so the credits for the solution are @MirGhojam

@skv-headless
Copy link
Collaborator

@gmlion hope it will work for everyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants