Giter Site home page Giter Site logo

Comments (5)

levity avatar levity commented on September 24, 2024 1

You can work around this by setting the global methods in a slightly different way, e.g.:

setTimeout = (fn, ms = 0) => Timer.setTimeout(fn, ms)
setInterval = (fn, ms = 0) => Timer.setInterval(fn, ms)
clearTimeout = (fn, ms = 0) => Timer.clearTimeout(fn, ms)
clearInterval = (fn, ms = 0) => Timer.clearInterval(fn, ms)

from react-native-background-timer.

ximxim avatar ximxim commented on September 24, 2024

I am getting almost the same error when I enable hot reloading and make a change.

After further testing, I can recreate this issue by setting a timeout with no second parameter. Any suggestions how to resolve this issue?

from react-native-background-timer.

maartenpetit avatar maartenpetit commented on September 24, 2024

This error occurs every time I enable remote debugging, both iOS and Android.
"react-native": "^0.50.3"
"react-native-background-timer": "^1.3.0"

The following error occurs in iOS:

simulator screen shot - iphone 6 - 2017-11-12 at 15 56 41

from react-native-background-timer.

tuna1207 avatar tuna1207 commented on September 24, 2024

@levity i set the global methods like your example but still get the error , do you have any idea ? 😓

from react-native-background-timer.

tuna1207 avatar tuna1207 commented on September 24, 2024

Got it solved by checking ms value

setTimeout = (fn, ms = 0) => {
  const numberMs = Number(ms)
  if (isNaN(numberMs)) return BackgroundTimer.setTimeout(fn, 0)
  return BackgroundTimer.setTimeout(fn, numberMs)
}
setInterval = (fn, ms = 0) => {
  const numberMs = Number(ms)
  if (isNaN(numberMs)) return BackgroundTimer.setInterval(fn, 0)
  return BackgroundTimer.setInterval(fn, numberMs)
}
clearTimeout = (fn, ms = 0) => {
  const numberMs = Number(ms)
  if (isNaN(numberMs)) return BackgroundTimer.clearTimeout(fn, 0)
  return BackgroundTimer.clearTimeout(fn, numberMs)
}
clearInterval = (fn, ms = 0) => {
  const numberMs = Number(ms)
  if (isNaN(numberMs)) return BackgroundTimer.clearInterval(fn, 0)
  return BackgroundTimer.clearInterval(fn, numberMs)
}

from react-native-background-timer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.