Camera Module
Quick Answer
The camera module lives in src/core/camera. Its main export is IMCameraModal, a reusable full-screen capture component built around Expo camera and image picker APIs inside the React Native app.
Use it when a user needs to capture or select media for posts, stories, profile photos, listings, reviews, or chat messages.
Source Map
src/core/camera
├── IMCameraModal.tsx
├── IMPreCamera.tsx
├── IMPostCamera.tsx
└── styles.ts
Key runtime dependencies are declared in the app package:
expo-camera
expo-image-picker
Main Component
IMCameraModal controls the camera preview, capture actions, gallery import, flash state, front/back camera switching, video recording, and post-capture preview.
Basic usage:
<IMCameraModal
isCameraOpen={isCameraOpen}
onCameraClose={onCameraClose}
onImagePost={onImagePost}
wrapInModal
/>
The callback receives the selected asset:
const onImagePost = mediaFile => {
// mediaFile.uri points to the local image or video.
// mediaFile.type is usually "image" or "video".
// Send this object to your media upload or post creation flow.
}
Common Props
| Prop | Purpose |
|---|---|
isCameraOpen | Controls whether the camera UI is visible. |
onCameraClose | Called when the user closes the camera. |
onImagePost | Called after the user confirms the captured or selected media. |
pickerMediaType | Limits gallery selection to images, videos, or all media when supported by the app flow. |
wrapInModal | Wraps the camera in a native modal. |
mediaSource | Shows an already selected media object in the post-capture UI. |
muteRecord | Records video without audio when the caller needs muted capture. |
Permissions
Camera and gallery access require native permissions. Check the app before release:
- iOS: camera, microphone, and photo library usage descriptions in
ios/*/Info.plist. - Android: camera, audio, and media permissions in
android/app/src/main/AndroidManifest.xmlwhen required by the selected flow.
If the module is used only for image picking, still test the native photo permission prompt on iOS and Android.
Media Upload Integration
IMCameraModal only returns a local media object. Uploads are usually handled by:
src/core/media
src/core/socialgraph/feed
src/core/chat
Keep upload error handling in the calling flow. For example, a social post screen should distinguish between:
- user canceled media selection;
- permission denied;
- local file missing;
- upload failed;
- Firestore write failed after upload.
Verification Checklist
Test on at least one simulator and one real device:
- open camera;
- grant camera permission;
- deny camera permission;
- switch front/back camera;
- take a photo;
- record a short video if the flow supports video;
- select media from the gallery;
- confirm the media and verify the parent screen receives
mediaFile.uri; - post or upload the media through the calling feature.
Troubleshooting
| Problem | Fix |
|---|---|
| Camera opens as a blank screen | Confirm camera permission, simulator/device support, and that no other native camera view is active. |
| Gallery picker returns no asset | Check permission status and verify that the user did not cancel the picker. |
| Video capture fails | Confirm microphone permission and test on a real device. |
| Upload fails after capture | Debug the caller's media upload flow, usually src/core/media or a Firebase Storage/Functions endpoint. |
| iOS release build is rejected | Confirm usage descriptions accurately describe why the app needs camera, microphone, and photo library access. |