-
Notifications
You must be signed in to change notification settings - Fork 86
Closed
Description
๐ฏ Goal
Implement real camera functionality in React Native using Expo Camera, allowing users to capture photos and preview them before upload.
This feature forms one of the core actions of SnapMap.
๐ Task Description
Build a fully functional camera screen with:
- Live camera preview
- Flash control
- Front/back camera switching
- Photo capture
- Preview on upload confirmation screen
This issue does not include backend upload logic โ only camera functionality.
๐ ๏ธ Steps to Achieve This
1. Request Camera Permissions
File:
/frontend/src/screens/CameraScreen.js
Use Expo Camera permission API:
const { status } = await Camera.requestCameraPermissionsAsync();Show fallback message if permission is denied.
2. Show Live Camera Preview
Initialize Expo Camera:
Ensure preview is fullscreen and responsive.
3. Add Camera Controls
Add UI buttons for:
- Shutter button โ triggers photo capture
- Flash toggle โ on/off
- Switch camera โ front/back
These controls must float or overlay on the camera preview.
4. Capture Photo
Use:
const photo = await cameraRef.current.takePictureAsync();After capturing:
- Navigate to
UploadConfirmationScreen - Pass the
photoobject as navigation params
5. Upload Confirmation Screen
Add an Upload Photo button (placeholder) and a Retake Photo.
On clicking Upload:
- Show a success popup (Toast / Alert)
- Log metadata in console:
- timestamp
- camera data
- location metadata: latitude, longitude
Note: Ensure these location metadata is being recorded, for this additional permissions will be required configure them also in this issue.
๐ค PR Submission
By completion:
- All previous implementation should be Intaced (signup and signin)
- User opens Camera Screen from Home Screen
- Live camera preview is visible
- Flash toggle & camera switch work
- Photo can be captured successfully
- Captured image appears on Upload Confirmation screen
- Upload & Retake buttons are visible
- Clicking โUpload Photoโ:
- Shows a success popup
- Logs metadata in console
- Returns back to Home Screen (will later change it accordingly)