gpt4 book ai didi

ios - Expo Camera 预览组件突然开始显示黑屏

转载 作者:行者123 更新时间:2023-11-28 23:26:22 26 4
gpt4 key购买 nike

npm 包“expo-camera”中的相机预览组件只显示黑屏。我什至创建了一个全新的托管 Expo 项目,只用了这段代码:

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import { Camera } from 'expo-camera';

export default function App() {
return (
<View style={styles.container}>
<Camera />
</View>
);
}

const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});

这是我的 package.json 文件:

{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "^35.0.0",
"expo-camera": "^7.0.0",
"react": "16.8.3",
"react-dom": "16.8.3",
"react-native": "https://github.com/expo/react-native/archive/sdk-35.0.0.tar.gz",
"react-native-web": "^0.11.7"
},
"devDependencies": {
"babel-preset-expo": "^7.1.0"
},
"private": true
}

这是我的 app.json:

{
"expo": {
"name": "testcamera",
"slug": "testcamera",
"privacy": "public",
"sdkVersion": "35.0.0",
"platforms": [
"ios",
"android",
"web"
],
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true
}
}
}

它突然停止工作。我做的最后一件事是发布 Expo 项目,在那之前它已经开始工作了。

最佳答案

带有钩子(Hook)和功能组件的工作示例,请求权限:

https://snack.expo.io/@djalik/camera

关于ios - Expo Camera 预览组件突然开始显示黑屏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58575757/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com