Documentation Index
Fetch the complete documentation index at: https://mintlify.com/soymatudev/Pokedex-Fleek/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheuseCamera hook provides a simple interface for managing camera functionality in the PokéDex app. It integrates with react-native-vision-camera to handle camera permissions and device selection, specifically targeting the wide-angle back camera for Pokémon identification.
Import
Usage
Return Values
The hook returns an object with the following method:startCameraService()
Initializes and configures the camera service.
Returns: Object containing:
device- The wide-angle camera device instancehasPermission- Boolean indicating whether camera permissions have been granted
Implementation Details
Camera Device Selection
The hook uses thewide-angle-camera device type, which typically selects the back camera on mobile devices:
Permission Management
Camera permissions are checked usingreact-native-vision-camera’s built-in permission hook:
Integration with react-native-vision-camera
This hook wraps the followingreact-native-vision-camera hooks:
useCameraDevice- Selects and manages camera device instancesuseCameraPermission- Handles camera permission states
Source Code
~/workspace/source/src/hooks/useCamera.js
Best Practices
- Always check
hasPermissionbefore attempting to use the camera - Verify that
deviceis not null before rendering camera components - Request camera permissions before calling
startCameraService() - Handle permission denials gracefully with appropriate UI feedback