In this example, we will show you how to initialize the Camera SDK’s mobile editor in your React Native app. We also prepared a dedicated example application which you can checkout on GitHub.
Requirements#
For this version, the minimum requirements are:
- React Native: 0.74
- iOS: 16
- Swift: 6.3.3 (Xcode 26.6.0)
- Android: 7
Add from npmjs.com#
In your Expo project, add the @imgly/camera-react-native module and the expo-build-properties config plugin:
npx expo install @imgly/camera-react-native@1.87.0-rc.3 expo-build-propertiesAndroid Setup#
In order to integrate the camera for Android, make some adjustments to your app.json file:
-
Replace the
"expo-build-properties"entry that the install command added topluginswith an entry that holds the options, as theapp.jsonunder Full Code shows. -
Add the
androidoptions to that entry: the IMG.LY Maven repository andminSdkVersion24.
iOS Setup#
In order to integrate the camera for iOS, make some adjustments to your app.json file as well:
-
Add the
iosoptions to the same entry:useFrameworksset tostatic. On Expo SDK 55 and older, also add"deploymentTarget": "16.0". -
Add the camera and microphone usage descriptions to
ios.infoPlist, as the sameapp.jsonshows.
If another library in your app needs dynamic frameworks, such as React Native Firebase, set "useFrameworks": "dynamic" instead. On Expo SDK 56 and later, also add "usePrecompiledModules": false to the ios options.
Usage#
In this example, we’ll demonstrate the basic usage of the camera.
In order to launch the camera, an instance of CameraSettings needs to be provided. For this, you only need to provide the license key that you received from IMG.LY.
Optionally, you can provide a unique ID tied to your application’s user. This helps us accurately calculate monthly active users (MAU) and it is especially useful when one person uses the app on multiple devices with a sign-in feature, ensuring they’re counted once.
const settings: CameraSettings = { license: 'YOUR_LICENSE_KEY',};Next, you can open the editor using the openCamera method.
const result = await IMGLYCamera.openCamera(settings);That is all. For more than basic configuration, check out all the available configurations.
Full Code#
Here’s the full code for both app.json and camera_react_native.ts.
app.json#
{ "expo": { "plugins": [ [ "expo-build-properties", { "android": { "extraMavenRepos": ["https://maven.img.ly/maven"], "minSdkVersion": 24 }, "ios": { "useFrameworks": "static" } } ] ], "ios": { "infoPlist": { "NSCameraUsageDescription": "This app uses the camera for demonstration purposes.", "NSMicrophoneUsageDescription": "This app uses the camera for demonstration purposes." } } }}camera_react_native.ts#
import IMGLYCamera, { CameraSettings } from '@imgly/camera-react-native';
export const camera = async (): Promise<void> => { const settings: CameraSettings = { license: 'YOUR_LICENSE_KEY', }; const result = await IMGLYCamera.openCamera(settings);};