-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Labels
🐛 bugSomething isn't workingSomething isn't working
Description
What's happening?
I started a new project, and it is not the first time I use vision camera, but for some reason now I can't request permission. I even tried to manually call requestPermission() with a button and it automaticly returns false with nothing appearing on the screen.
Reproduceable Code
import { View, Text, StyleSheet, Button } from 'react-native'
import React, { useEffect } from 'react'
import { useCameraPermission, Camera, useCameraDevices, useCameraDevice } from 'react-native-vision-camera'
export default function Home() {
const external = useCameraDevice('external');
const back = useCameraDevice('back');
const { hasPermission, requestPermission } = useCameraPermission();
const request = async () => {
const result = await requestPermission();
console.log(result);
// returns false immediatly after calling the function
}
if (!hasPermission) {
console.log('no permission');
request();
}
return (
// <Camera
// style={StyleSheet.absoluteFill}
// device={back!}
// isActive={true}
// />
<View style={{
backgroundColor: 'white',
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}}>
<Text>
has permission: {hasPermission ? 'yes' : 'no'}
</Text>
<Button
onPress={() => request()}
title="request permission"
/>
</View>
)
}Relevant log output
.Camera Device
.Device
S22 ultra
VisionCamera Version
4.6.4
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (
Additional information
- I am using Expo
- I have enabled Frame Processors (react-native-worklets-core)
- I have read the Troubleshooting Guide
- I agree to follow this project's Code of Conduct
- I searched for similar issues in this repository and found none.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
🐛 bugSomething isn't workingSomething isn't working