我花了几个小时在这上面,但我无法弄清楚这一点。 我是 AR 库的新手,我一直在尝试执行一个简单的应用程序来查看 AR 的强大功能:
当我注释掉“位置”时,应用程序运行没有问题。
<ViroARScene>
<ViroText
text={"Hello World"}
textLineBreakMode="Justify"
textClipMode="ClipToBounds"
color="#ff0000"
width={2}
height={2}
position={[0, 2, 0]}
style={{
fontFamily: "Arial",
fontSize: 15,
// fontWeight: 400,
fontStyle: "italic",
color: "#0000FF",
textAlignVertical:"top"
}}
/>
</ViroARScene>
package.json:
{
"name": "arsocialstories2",
"main": "expo-router/entry",
"version": "1.0.0",
"scripts": {
"start": "expo start",
"reset-project": "node ./scripts/reset-project.js",
"android": "expo run:android",
"ios": "expo run:ios",
"web": "expo start --web",
"test": "jest --watchAll",
"lint": "expo lint"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"@expo/vector-icons": "^14.0.2",
"@react-navigation/native": "^6.0.2",
"@reactvision/react-viro": "^2.41.6",
"expo": "~51.0.26",
"expo-camera": "~15.0.14",
"expo-constants": "~16.0.2",
"expo-font": "~12.0.9",
"expo-linking": "~6.3.1",
"expo-router": "^3.5.21",
"expo-splash-screen": "~0.27.5",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.7",
"expo-web-browser": "^13.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.74.5",
"react-native-gesture-handler": "~2.16.1",
"react-native-reanimated": "~3.10.1",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "3.31.1",
"react-native-web": "~0.19.10"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@types/jest": "^29.5.12",
"@types/react": "~18.2.45",
"@types/react-test-renderer": "^18.0.7",
"jest": "^29.2.1",
"jest-expo": "~51.0.3",
"react-test-renderer": "18.2.0",
"typescript": "~5.3.3"
},
"private": true
}
我对 swift 不太熟悉,所以调试和检查问题很痛苦 任何帮助都非常感激!
好吧,我发现了问题。显然,最新版本的“@reactvision/react-viro 不太喜欢 expo 51。我不得不将 expo 降级到 v50,问题就消失了!