ОШИБКА [TypeError: Неверная попытка деструктурировать неитерируемый
экземпляр. Чтобы быть итерируемыми, объекты, не являющиеся массивами, должны иметь метод
Symbol.iterator.]
Я работаю над настройкой окна с помощью Expo-Go на своем iPhone. Я думаю, проблема может быть в моей версии экспо-камеры. Это действительно новичок в этом деле, поэтому, если есть лучший подход к этому, я открыт для любых предложений.
├── @expo/vector-icons@15.0.3
├── @react-navigation/bottom-tabs@7.8.5
├── @react-navigation/elements@2.8.2
├── @react-navigation/native@7.1.20
├── expo-camera@17.0.9
├── expo-constants@18.0.10
├── expo-font@14.0.9
├── expo-haptics@15.0.7
├── expo-image@3.0.10
├── expo-linking@8.0.8
├── expo-router@6.0.14
├── expo-splash-screen@31.0.10
├── expo-status-bar@3.0.8
├── expo-symbols@1.0.7
├── expo-system-ui@6.0.8
├── expo-web-browser@15.0.9
├── expo@54.0.23
├── react-dom@19.1.0
├── react-native-gesture-handler@2.28.0
├── react-native-reanimated@4.1.5
├── react-native-safe-area-context@5.6.2
├── react-native-screens@4.16.0
├── react-native-web@0.21.2
├── react-native-worklets@0.5.1
├── react-native@0.81.5
└── react@19.1.0
MainPage
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import React, { useState, useEffect } from 'react';
import { View, Text, Button } from 'react-native';
import { Camera } from 'expo-camera';
import HomeScreen from './HomeScreen';
import DetailsScreen from './DetailsScreen';
import SettingsScreen from './SettingsScreen';
import CameraScreen from './CameraScreen';
export type RootStackParamList = {
Home: undefined;
Details: undefined;
Settings: undefined;
Camera: undefined;
};
const Stack = createNativeStackNavigator();
export default function PermissionsScreen({ onGranted }: { onGranted?: () => void }) {
const [status, setStatus] = useState(null);
useEffect(() => {
Camera.getCameraPermissionsAsync().then(res => {
setStatus(res.granted ? 'granted' : 'denied');
if (res.granted && onGranted) onGranted();
});
}, []);
const ask = async () => {
const res = await Camera.requestCameraPermissionsAsync();
setStatus(res.granted ? 'granted' : 'denied');
if (res.granted && onGranted) onGranted(); //
};
if (status === 'undetermined' || status === null) {
return (
Checking camera permissions …
);
}
if (status === 'denied') {
return (
Need camera permission
);
}
return (
({
title: 'Home',
headerRight: () => (
navigation.navigate('Settings')}
/>
navigation.navigate('Camera')}
/>
),
})}
/>
)
CameraPage
const toggleCameraFacing = () => {
setFacing(current => (current === 'back' ? 'front' : 'back'));
};
return (
Flip Camera
);
}
const styles = StyleSheet.create({
container: { flex: 1, justifyContent: 'center' },
message: { textAlign: 'center', paddingBottom: 10 },
camera: { flex: 1 },
buttonContainer: {
position: 'absolute',
bottom: 64,
flexDirection: 'row',
backgroundColor: 'transparent',
width: '100%',
paddingHorizontal: 64,
},
button: { flex: 1, alignItems: 'center' },
text: { fontSize: 24, fontWeight: 'bold', color: 'white' },
});
Подробнее здесь: https://stackoverflow.com/questions/798 ... os-expo-go
Мобильная версия