Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

react-native error after import firebase

I have installed firebase package in my project using cmd

npm install --save firebase 

When I import firebase to my react-native project import firebase from 'firebase' I'm getting this error. What could be the problem? enter image description here

like image 748
Touch sophonara Avatar asked Jun 29 '18 09:06

Touch sophonara


2 Answers

Follow this pattern the error will be resolved the issue is due to upgradation in Firebase repo:

import React, {Component} from 'react';
import {Text, View} from 'react-native';
// import firebase from 'firebase';
import firebase from '@firebase/app'
import { Header } from './Components/Common';
like image 137
dolar Avatar answered Nov 03 '22 14:11

dolar


Ran into Same issue i solved it by installing babel polyfill

npm i --save-dev babel-polyfill

then in my index.js:

import 'babel-polyfill';
like image 38
Syntax Hacker Avatar answered Nov 03 '22 14:11

Syntax Hacker