question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

null is not an object (evaluating 'RNBackgroundTimer.setTimeout') - RN version 0.60.4

See original GitHub issue

I am continually getting this error thrown and it stops the background timer from working on Android. It works no issues on iOS however.

I am not using the setTimeout function at all, I am using BackgroundTimer.setInterval if the platform is Android and using BackgroundTimer.runBackgroundTimer for iOS as even though it says it is cross platform, it only seemed to work for iOS.

React Native version: 0.60.4 React: 16.9.0 react-native-background-timer: 2.1.1

I have tried manually linking as the readme suggests, but this did not resolve the issue. Any help would be much appreciated.

passiveMode = () => {
    if (this.platform == 'ios') {
      BackgroundTimer.runBackgroundTimer(() => {
        this.main()
      }, 6000);
    } else {
      this.bgIntFunc = BackgroundTimer.setInterval(() => {
        this.main()
      }, 6000);
    }
    this.active = false
  }

As soon as the setInterval function gets called, the error is thrown and all the functionality stops for the background timer.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

3reactions
eyalecommented, Dec 5, 2019

Try

rm package-lock.json || true && npm i && cd ios && rm -rf Pods || true && rm Podfile.lock || true && pod install && cd ../
2reactions
Nogias9xcommented, Jul 8, 2021

I’m also facing this problem although I already followed the README (manual linking included) 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-background-timer, null is not an object
The equipped function, setInterval of javascript and etc. of course works fine as a timer, but actually they don't work behind in react...
Read more >
null is not an object (evaluating 'RNBackgroundTimer.setTimeout ...
null is not an object (evaluating 'RNBackgroundTimer.setTimeout') - RN version 0.60.4 ... I am continually getting this error thrown and it stops the...
Read more >
react-native-background-timer - npm
Emit event periodically (even when app is in the background). Latest version: 2.4.1, last published: 2 years ago.
Read more >
react-native-background-timer - npm package - Snyk
Learn more about react-native-background-timer: package health score, popularity, security, maintenance, versions and more.
Read more >
React Native Background Timer - Morioh
Android: TypeError: Cannot read property 'setTimeout' of undefined or TypeError: null is not an object (evaluating 'RNBackgroundTimer.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found