Can't find a variable atob

后端 未结 4 2004
粉色の甜心
粉色の甜心 2020-12-08 23:11

Screen1.js

import React,{useEffect} from \'react\'
import {View,Text} from \'react-native\'
import * as firebase from \'firebase/app\';
import \'@firebase/fi         


        
相关标签:
4条回答
  • 2020-12-09 00:00

    I found a workaround, I still there is a bug on their side. They just released 2 days ago version 7.9.1. Try to use 7.9.0.

    yarn add firebase@7.9.0

    I am creating an issue for it, follow here.

    0 讨论(0)
  • 2020-12-09 00:00

    Thanks @Pradeep. This worked for me on firebase 7.14.1:

    import {decode, encode} from 'base-64'
    
    if (!global.btoa) {  global.btoa = encode }
    
    if (!global.atob) { global.atob = decode }
    

    and using import like this

    import firebase from 'firebase';
    import 'firebase/firestore'
    
    0 讨论(0)
  • 2020-12-09 00:02

    I have tried downgrading but that's not resulted as a solution to me. I don't know why.

    The global import of base64 in the app.js resolved this problem.

    import {decode, encode} from 'base-64'
    
    if (!global.btoa) {  global.btoa = encode }
    
    if (!global.atob) { global.atob = decode }
    

    Thanks for your responses.

    0 讨论(0)
  • 2020-12-09 00:10

    Worked for me ! Thanks papay0, there is indeed something wrong with version 7.9.1.

    npm install firebase@7.9.0
    expo r -c # restard expo without cache
    

    You can rm -rf ./node_modules/ && npm i

    0 讨论(0)
提交回复
热议问题