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.

undefined is not an object (evaluating 'FIRAnalytics.setEnabled)

See original GitHub issue

image

using react-native-firbase-analytics 1.0.6 using react-native 0.32.0

import React, {
  Component,
  PropTypes,
} from 'react';
import {
  View, 
  StyleSheet,
  ScrollView,
  Alert,
  AlertIOS,
  InteractionManager,
} from 'react-native';
import Analytics from 'react-native-firebase-analytics';
import Dialog from 'react-native-dialog';

// ...

export default class CartPage extends Component {       
  constructor(props) {                                  
    super(props);                                       
    this.state = {                                      
      renderPlaceholderOnly: false,                     
    };                                                  
    props.dispatch(fetchCartInfo(props.serviceType));   
    props.dispatch(fetchMyCouponCount());               
  }                                                     
                                                        
  componentWillMount() {                                
    console.log(Analytics.setEnabled);                  
    Analytics.setEnabled(false);                        
  }                                                     

I trying run this Component. occurring error undefined is not an object (evaluating 'FIRAnalytics.setEnabled)

but console is that.

02-04 19:52:28.531  2896  2959 I ReactNativeJS: [Function: setEnabled]
02-04 19:52:29.127  2896  2959 E ReactNativeJS: undefined is not an object (evaluating 'FIRAnalytics.setEnabled')

Naturally, I included google-service.json file as well. and already run rnpm link what the hell? I think NativeModules.RNFIRAnalytics is undefined. What should I check?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:5
  • Comments:6

github_iconTop GitHub Comments

8reactions
ngothanhtaicommented, Feb 7, 2017

I think the rnpm link not correctly. If you are using the latest react native, I am not sure, around >= 0.39. You should add FIRAnalyticsPackage in MainApplication.java rather than MainActivity.java.

import com.evollu.react.fa.FIRAnalyticsPackage;
@Override
protected List<ReactPackage> getPackages() {
      return Arrays.<ReactPackage>asList(
          new FIRAnalyticsPackage(),
          new MainReactPackage()
      );
}
0reactions
Naveenkant93commented, Sep 7, 2018

Same issue in Ios

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS undefined is not an object (evaluating 'FirebaseAnalyitcs ...
In the simulator I see the error: Then I get undefined is not an object (evaluating 'FirebaseAnalyitcs.setCurrentScreen');.
Read more >
undefined is not an object (evaluating 'auth.tenanatId') in ...
i am making a authentication app in react native with firebase and i get this error in the sign up process called undefined...
Read more >
User | JavaScript SDK | Firebase JavaScript API reference
MultiFactorUser object corresponding to the current user. ... Thrown if you have not enabled the phone authentication provider in the Firebase Console.
Read more >
Error with all external API calls on IOS build: TypeError
All previous builds were working but now not even when I remove ... TypeError: undefined is not an object (evaluating 'environment.match').
Read more >
react-native-firebase-analytics - Bountysource
I suggest something like setEnabled . The default would be not to log, ... TypeError: undefined is not an object (evaluating 'FIRAnalytics.setUserId') $...
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