【发布时间】:2021-03-12 05:17:36
【问题描述】:
我有一个 React Native/Expo + Next.js 应用程序(使用 npx create-next-app -e with-expo 构建)
完整代码:https://github.com/tomsoderlund/reactnative-nextjs-template
它作为网络应用程序运行良好(在 Next.js 和 Expo Web 中),但在 iPhone 上的 Expo 应用程序上运行时崩溃:
ReferenceError: Can't find variable: React
This error is located at:
in App (at withExpoRoot.js:26)
in ExpoRoot (at renderApplication.js:40)
in RCTView (at AppContainer.js:101)
in DevAppContainer (at AppContainer.js:115)
in RCTView (at AppContainer.js:119)
in AppContainer (at renderApplication.js:39)
我怎样才能让它运行?
【问题讨论】:
-
您是否尝试在您的
index.js页面顶部添加import React from 'react'? -
@juliomalves 天哪,就是这么简单!谢谢!
标签: react-native expo next.js