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

setTimeout is broken #9030

Closed
bradennapier opened this issue Jul 26, 2016 · 5 comments
Closed

setTimeout is broken #9030

bradennapier opened this issue Jul 26, 2016 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@bradennapier
Copy link

bradennapier commented Jul 26, 2016

Not really sure here but somethign is fishy.. I am running on device via debug mode.

componentDidMount()` {
    console.log('Modal Mounts!')
    setTimeout(() => {
      console.log('Open')
      this.props.openModal()
    }, 10000)


  }

This will always fire instantly... about 100 ms

componentDidMount() {
    console.log('Modal Mounts!')
    setTimeout(() => {
      console.log('Open')
      this.props.openModal()
    }, 30000)


  }

Fires instantly as well

componentDidMount() {
    console.log('Modal Mounts!')
    setTimeout(() => {
      console.log('Open')
      this.props.openModal()
    }, 80000)


  }

Fires after about 30 seconds

@bradennapier
Copy link
Author

To further illustrate this problem...

console.log('In Modal')
setTimeout(() => console.log('Five Seconds'), 5000)

image

@mangogogos
Copy link
Contributor

mangogogos commented Jul 27, 2016

Check that your device's time matches that of your computer! This happened to me and took an unfortunately long while to debug haha

@matt-oakes
Copy link
Contributor

There is already an issue open for this. There doesn't seem to be any fix on the way however.

#4470

@lacker
Copy link
Contributor

lacker commented Oct 28, 2016

Looks like this is now fixed as discussed in #9436 .

@lacker lacker closed this as completed Oct 28, 2016
@JanithaR
Copy link

@mangogogos Is correct. I had the problem of time drifting more than 60s and I corrected it but still there was a few seconds difference between the emulator and the system. Hilariously by the time I read his comment and looked back at the emulator I realized my code had actually executed after the delay.

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants