Camera, a module which lives in Core/camera, is our subsystem that allows taking photos and videos with the full screen camera. IMCameraModal is the most important component, which can be used as follows:
<IMCameraModal isCameraOpen={isCameraOpen} onImagePost={onImagePost} onCameraClose={onCameraClose} />
This component handles a few complex tasks, such as:
- switching between front (IMPreCamera.js) and back camera (IMPostCamera.js)
- taking pictures
- recording videos
- importing photos and videos from the library
It sends back the asset source via onImagePost callback. Here’s a simple implementation of handling the response of camera selection:
onPostStory = async source => { // use source.uri to handle the asset on device (photo / video) }
Under the hood, it relies on expo-camera package.