【问题标题】:ReferenceError: Can't find variable: Text (i am using expo application for react native)ReferenceError:找不到变量:文本(我正在使用 expo 应用程序进行本机反应)
【发布时间】:2018-12-03 03:12:48
【问题描述】:

在我的设备中下载 java 脚本后,此错误显示在我的 ios 屏幕中。

ReferenceError: Can't find variable: Text

This error is located at:
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:33)
in RCTView (at View.js:60)
in View (at AppContainer.js:102)
in RCTView (at View.js:60)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:32)

【问题讨论】:

  • 在您的问题中添加代码

标签: react-native expo referenceerror


【解决方案1】:

从 react native 导入文本。

 import {
      View,
      Text,
 } from 'react-native';

【讨论】:

    【解决方案2】:

    在这里导入react-native 是不够的。

    找不到模块:无法解析“react-native”

    相反,您需要一个额外的包:

    yarn add react-native-web
    

    现在你可以使用了

    import {Text} from 'react-native'
    

    【讨论】:

      猜你喜欢
      • 2020-06-26
      • 1970-01-01
      • 2021-02-14
      • 1970-01-01
      • 2022-08-23
      • 1970-01-01
      • 2018-12-30
      • 2021-02-17
      • 1970-01-01
      相关资源
      最近更新 更多