屏幕1.js

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

const Screen1 = props =>{

    useEffect(() => 
    {
        var dbh = firebase.firestore().collection("Jots").doc("note");
        dbh.set({name:"pradeep"}) //The yellow warning is popped up in this line.
    }); 

    return(
             <View>
                <Text>Title</Text>
             </View>
    )
}

安慰

[Unhandled promise rejection: ReferenceError: Can't find variable: atob]

Stack trace:
  node_modules\@firebase\firestore\dist\index.cjs.js:23101:0 in <global>
  http://192.168.0.108:19001/node_modules%5Cexpo%5CAppEntry.bundle?platform=android&dev=true&minify=false&hot=false:131203:60 in fromBase64String


我只是遵循了expo 文件中的指南,但仍然不知道为什么会出现这个问题.需要一个明确的解释.还有什么是atob变量?

推荐答案

我try 过降级,但结果并不是我的解决方案.我不知道为什么.

app.js年全球进口base64个解决了这个问题.

import {decode, encode} from 'base-64'

if (!global.btoa) {  global.btoa = encode }

if (!global.atob) { global.atob = decode }

谢谢你的回复.

React-native相关问答推荐

如何停止在Expo路由中将新文件显示为菜单列表?

使用FETCH发送BLOB/文件时为空

如何在 React Native 中正确地将组件导入到我的导航器中?

如何解决Readonly<{}> 类型上不存在属性 navigation&

开发 React Native Apps 时如何在 Android 模拟器窗口中重新加载?

TextInput 防止 ScrollView 滚动

react-native redux 和 ListView

React-Native 是单线程执行还是多线程执行?

如何在react-native中淡化视图的边缘?

React-native 组件的 elevation样式导致的阴影

Firebase检测用户是否存在

在 Windows 上进行本机调试

React native base headers for ios not found

在 React Native 中仅显示第一行文本

Yarn 在哪里存储离线包?

在关闭 react-native 时更改 Switch 的 colored颜色

无法判断模块react-native-maps:找不到名称为 default的配置

JSON 解析错误:无法识别的令牌'<'

单击平面列表中的侦听器

如何在 React-Native 中停止touch 事件传播