Im am writing this code in react native with expo but the problem is when I click the button its giving me an error Warning: TypeError: Cannot read property ‘Type’ of undefined
here is the button:
<TouchableOpacity style={[styles.menuItem, styles.activeMenu]} onPress={handleCameraScanIn}>
<Icon name="chart-line" size={20} color="#fff" />
<Text style={styles.menuText}>Live Overview</Text>
</TouchableOpacity>
here is my CameraScanIn.js
import React, { useState, useEffect } from 'react';
import { View, Text, StyleSheet } from 'react-native';
import { Camera } from 'expo-camera';
export default function CameraScan() {
const [hasPermission, setHasPermission] = useState(null);
const [cameraRef, setCameraRef] = useState(null);
// Request camera permissions on mount
useEffect(() => {
(async () => {
const { status } = await Camera.requestCameraPermissionsAsync();
setHasPermission(status === 'granted');
})();
}, []);
if (hasPermission === null) {
return <Text>Requesting camera permission...</Text>;
}
if (hasPermission === false) {
return <Text>No access to camera</Text>;
}
return (
<View style={styles.container}>
<Camera style={styles.camera} ref={(ref) => setCameraRef(ref)} />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
camera: {
flex: 1,
width: '100%',
},
});
here is my package.json
{
"name": "camerascanner",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo "Error: no test specified" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@expo/metro-runtime": "~4.0.0",
"@react-navigation/native": "^7.0.3",
"@react-navigation/stack": "^7.0.3",
"axios": "^1.7.7",
"expo": "^52.0.7",
"expo-camera": "~16.0.5",
"expo-image-manipulator": "^13.0.5",
"firebase": "^11.0.2",
"react-dom": "18.3.1",
"react-native-paper": "^5.12.5",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^4.1.0",
"react-native-vector-icons": "^10.2.0",
"react-native-web": "~0.19.13",
"react-navigation": "^4.4.4",
"react-navigation-stack": "^2.10.4"
},
"devDependencies": {
"@babel/core": "^7.24.0"
}
}
How can I solve this? so that when I clicked the button it will not show me that error I keep on struggling over this. It will be a nice if someone can help me with this thank you.