Error while running a React-Native and firebase project

Asked

Viewed 116 times

0

Good morning/dawn, I’m having the error giving React-Native run-android inserir a descrição da imagem aqui

the code is this

import firebase from 'firebase';
import React, { Component } from 'react';
import {Text, View, Button} from 'react-native';

export default class App extends Component  {
    componentDidMount(){
        var config = {
            apiKey: "AIzaSyCrI-yOVMpn4SSzaAaiCmcZxPSsjS1mIYE",
            authDomain: "configuracaofirebasereac-1fcea.firebaseapp.com",
            databaseURL: "https://configuracaofirebasereac-1fcea.firebaseio.com",
            projectId: "configuracaofirebasereac-1fcea",
            storageBucket: "configuracaofirebasereac-1fcea.appspot.com",
            messagingSenderId: "61563493608";
        };
        firebase.initializeApp(config)
    }

    render() {
        return (
            <View>
                <Text>Olá Mundo</Text>
            </View>
        );
    }
 } 

and I can’t seem to find a way to fix it, someone please give me a hand?

  • Instead of putting the code into the IdMount component, put it into the IllMount component

1 answer

0

Friend make the following change in your code:

// import firebase from 'firebase';
import firebase from '@firebase/app'

Or install firebase version 5.0.3, or more current (recommend using firebase Yarn).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.