11

I am using Firebase with React Native. Firebase shows me a timer warning as shown in the screenshot.

enter image description here

I read the following note in the React Native troubleshooting guide.

React Native implements a polyfill for WebSockets. These polyfills are initialized as part of the react-native module that you include in your application through import React from 'react'. If you load another module that requires WebSockets, such as Firebase, be sure to load/require it after react-native:

import React from 'react';
import Firebase from 'firebase';

I tried import React before Firebase. But, I still keep getting these timer warnings. The application does work fine. I keep getting multiple warnings at regular intervals. Any help would be well appreciated.

I am using the latest React Native and the warning comes in the Android emulator.

1

5 Answers 5

19

To sort this out all need to do is increase the value of the variable MAX_TIMER_DURATION_MS. Here are the steps:

  1. Go to node_modules/react-native/Libraries/Core/Timer/JSTimers.js

  2. Look for the variable MAX_TIMER_DURATION_MS

  3. Change 60 * 1000 to 10000 * 1000 , needed for firebase

  4. Save the changes and re-build your app.

3
  • 10
    Is there a way to do this in the app source code? I sometimes have to remove the node_modules
    – Norfeldt
    May 18, 2019 at 15:33
  • 4
    This is not a solution. This just skips the error and requires changes to node_modules. The same can be achieved (and better) via YellowBox.ignoreWarnings([Setting a timer for])! However not using setTimeout within Firebase would be a real solution
    – Maddis
    Jan 5, 2021 at 13:28
1

You could also switch to the native SDK's via a wrapper, it's generally much more performant as it's done natively so there's no timer warnings plus you get access to more than just the auth and database modules.

One such wrapper is react-native-firebase and it currently supports 10+ firebase modules:

Supported modules table

Disclaimer: author of the above.

0

It's worked for me to changed to both variable's values.

const FRAME_DURATION = 100000 / 60;

const MAX_TIMER_DURATION_MS = 60 * 100000;

0

Its worked for me also.

Go to node_modules/react-native/Libraries/Core/Timer/JSTimers.js

Look for the variable MAX_TIMER_DURATION_MS

Change 60 * 1000 to 10000 * 1000 , needed for firebase

Save the changes and re-build your app.

0

It's worked for me to changed values.

const FRAME_DURATION = 100000 / 60;

const MAX_TIMER_DURATION_MS = 60 * 100000;
1
  • not a solution to the issue, just hides the warning basically. Feb 15, 2022 at 14:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.