Warning: Internal React error: Expected static flag was missing. Please notify the React team
复现的代码
import { useEffect, useRef } from 'react'
import React from 'react';
const ModalShop = ({ isVisible, onClose }) => {
if (!isVisible) return null;
const handleClose = (e) => {
if (e.target.id === 'wrapper') { onClose(); }
}
const inputRef = useRef(null);
const spanRef = useRef(null);
useEffect(() => {
...
}, []);
return (...
}
export default ModalShop;
解决:
if (!isVisible) return null; // 移动到钩子后面
TypeError: dependencies is not iterable
原文连接:https://github.com/expo/create-react-native-app/issues/931#issuecomment-2353688003
解决:删除C:\Users{user}\AppData\Local\Temp
或者
- 删除 React Native 项目内的“.expo”文件夹
- npm cache clean --force来清除全局 npm 缓存
- npx expo start --clear重新启动服务器
- npx expo start --tunnel在隧道中重启服务器
打包失败
例如:
- Build failed: Gradle build failed with unknown error. See logs for the “Run gradlew” phase for more information.
- cannot find symbol import expo.core.ExpoModulesPackage
首先执行检查下依赖冲突
npx expo-doctor
如果你使用pnpm, 在.npmrc
新增
node-linker=hoisted
我到这里就可以了。
如果还不行
在package.json 新增:
“expo-modules-autolinking”: “*”