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
TypeError : expected 'double' but had 'boolean' RNBackgroundTimer.setTimeout #65
Comments
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? |
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) |
@levity i set the global methods like your example but still get the error , do you have any idea ? 😓 |
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)
} |
I got some issues with
react-native: ^0.49.3
...Hope you can help ^^,
removed it temporary and using default React Native Timer...
The text was updated successfully, but these errors were encountered: