-
Notifications
You must be signed in to change notification settings - Fork 2.3k
setTimeout() instead of InteractionManager #534
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
Conversation
In componentDidMount() of index.js, using a timeout resolves a problem with scrollView.scrollTo() not working
|
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. |
|
I didn't, it's only automatic formatting...sorry for the noise |
|
@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); |
There was a problem hiding this comment.
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(() => { |
There was a problem hiding this comment.
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
As documented in https://facebook.github.io/react-native/docs/timers.html, using this.setTimeout
|
@gmlion I dont know what is working |
|
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 |
|
@gmlion hope it will work for everyone. |
In componentDidMount() of index.js, using a timeout resolves a problem
with scrollView.scrollTo() not working