Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-native-photoeditorsdk

imgly7.6kBSD-3-Clause3.3.0TypeScript support: included

A React Native module for PhotoEditor SDK. Integrate the photo editor into your own HTML5, iOS or Android app - in minutes!

react-native, image, image editor, imageeditor, photo, photo editor, photoeditor, photoeditorsdk, PhotoEditor SDK, SDK, ios, android

readme

PhotoEditor SDK Logo

NPM version Platform support Twitter

React Native module for PhotoEditor SDK

Check out our video tutorial for a step-by-step integration guide which also details advanced SDK features, such as serializing and reusing previously applied editing operations.

System requirements

  • React Native: 0.60
  • iOS: 13
  • Android: 5 (SDK 21)

Getting started

Expo CLI

Limitations

This module can not be used in the Expo Go application because it uses custom native libraries.

Usage

In order to use this module with the Expo CLI you can make use of our integrated Expo config plugin:

  1. Add our module to your Expo application:

    expo install react-native-photoeditorsdk

    This will automatically install react-native-imglysdk which you can use to configure your application with our Expo config plugin.

  2. Inside your app's app.json or app.config.js add our config plugin:

    {
      "plugins": ["react-native-imglysdk"]
    }

    If needed, you can also use a specific version of our native library for Android as well as define explicitly the included modules. By default, all modules for both PhotoEditor SDK and VideoEditor SDK are included. Further, you can alternate the KSP version with the kspVersion parameter based on the Kotlin version you are using. Please take a look here on further details. s For Expo version < 45, you can configure the buildToolsVersion, minSdkVersion, compileSdkVersion, targetSdkVersion, and kotlinGradlePluginVersion. From version 45+ we recommend setting these properties using the expo-build-properties config plugin directly.

    {
      "plugins": [
        [
          "react-native-imglysdk",
          {
            "android": {
              "version": "10.9.0",
              "kspVersion": "1.8.0-1.0.9",
              "modules": [
                "ui:core",
                "ui:transform",
                "ui:filter",
                "assets:filter-basic"
              ],
              "buildToolsVersion": "34.0.0",
              "minSdkVersion": "21",
              "compileSdkVersion": "34",
              "targetSdkVersion": "34",
              "kotlinGradlePluginVersion": "1.8.0"
            }
          }
        ]
      ]
    }

    For further information on the available modules, please refer to step 4 of the React Native CLI Android guide below.

    Please note that the react-native-imglysdk module manages both VideoEditor SDK as well as PhotoEditor SDK so you only need to add the Expo config plugin once even when using both SDKs.

  3. From version 2.15.0 the iOS deployment target needs to be set to at least iOS 13. You can use the expo-build-properties config plugin for this. Please refer to the official Expo docs.

  4. The changes will be applied on expo prebuild or during the prebuild phase of eas build.

For further information on how to integrate Expo config plugins please also refer to the official docs.

React Native CLI

Install the React Native module in your project as follows:

yarn add react-native-photoeditorsdk

In general, we highly recommend using React Native 0.60 or newer. If you cannot avoid using an older React Native version you need to link the native dependencies with:

yarn react-native link

before you continue with the platform-specific guides below.

iOS

For React Native 0.60 and newer autolinking is used and PhotoEditor SDK for iOS should be automatically installed:

cd ios && pod install && cd ..

and updated:

cd ios && pod update && cd ..

with CocoaPods.

For older React Native versions autolinking is not available and PhotoEditor SDK for iOS needs to be manually integrated in your Xcode project if you don't use CocoaPods to manage your dependencies. Make sure to put ImglyKit.framework and PhotoEditorSDK.framework in the ios/ directory of your project.

Android

  1. Add the IMG.LY repository and plugin by opening the android/build.gradle file (not android/app/build.gradle) and adding these lines at the top:

    buildscript {
        repositories {
            mavenCentral()
            maven { url "https://artifactory.img.ly/artifactory/imgly" }
        }
        dependencies {
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.8.0"
            classpath 'com.google.devtools.ksp:com.google.devtools.ksp.gradle.plugin:1.8.0-1.0.9' // KSP version is depending on your Kotlin version.
            classpath 'ly.img.android.sdk:plugin:10.9.0'
        }
    }

    The KSP version depends on the Kotlin version that you are using. In order to find the correct version, please visit the official KSP release page.

    In order to update PhotoEditor SDK for Android replace the version string 10.9.0 with a newer release.

  2. Still in the android/build.gradle file (not android/app/build.gradle), add these lines at the bottom:

    allprojects {
        repositories {
            maven { url 'https://artifactory.img.ly/artifactory/imgly' }
        }
    }
  3. In the same file, you will need to modify the minSdkVersion to at least 21. We also recommend to update the buildToolsVersion to 34.0.0 or higher as well as the compileSdkVersion to 34 or higher but this is not mandatory:

    buildscript {
        ext {
    -       buildToolsVersion = "30.0.2"
    +       buildToolsVersion = "34.0.0"
    -       minSdkVersion = 19
    +       minSdkVersion = 21
    -       compileSdkVersion = 34
    +       compileSdkVersion = 34
            targetSdkVersion = 34
        }
    }
  4. Configure PhotoEditor SDK for Android by opening the android/app/build.gradle file (not android/build.gradle) and adding the following lines under apply plugin: "com.android.application":

    apply plugin: 'ly.img.android.sdk'
    apply plugin: 'kotlin-android'
    
    // Comment out the modules you don't need, to save size.
    IMGLY.configure {
        modules {
            include 'ui:text'
            include 'ui:focus'
            include 'ui:frame'
            include 'ui:brush'
            include 'ui:filter'
            include 'ui:sticker'
            include 'ui:overlay'
            include 'ui:transform'
            include 'ui:adjustment'
            include 'ui:text-design'
    
            // This module is big, remove the serializer if you don't need that feature.
            include 'backend:serializer'
    
            // Remove the asset packs you don't need, these are also big in size.
            include 'assets:font-basic'
            include 'assets:frame-basic'
            include 'assets:filter-basic'
            include 'assets:overlay-basic'
            include 'assets:sticker-shapes'
            include 'assets:sticker-emoticons'
    
            include 'backend:sticker-smart'
            include 'backend:background-removal'
        }
    }

Usage

Import the module in your App.js:

import {
  PESDK,
  PhotoEditorModal,
  Configuration,
} from "react-native-photoeditorsdk";

Each platform requires a separate license file. Unlock PhotoEditor SDK with a single line of code for both platforms via platform-specific file extensions:

PESDK.unlockWithLicense(require("./pesdk_license"));

Open the editor with an image:

PESDK.openEditor(require("./image.jpg"));

Or use the component to open the editor:

<PhotoEditorModal visible={true} image={require("./image.jpg")} />

Please see the code documentation for more details and additional customization and configuration options.

For configuring and customizing PhotoEditor SDK beyond these options exposed to JavaScript the iOS bridge provides an interface for native customization. Please refer to our documentation for more details on native customization.

Example

Please see our example project which demonstrates how to use the React Native module for PhotoEditor SDK.

License Terms

Make sure you have a commercial license for PhotoEditor SDK before releasing your app. A commercial license is required for any app or service that has any form of monetization: This includes free apps with in-app purchases or ad supported applications. Please contact us if you want to purchase the commercial license.

Support and License

Use our service desk for bug reports or support requests. To request a commercial license, please use the license request form on our website.

changelog

[3.3.0]

Changed

  • [react-native-imglysdk] Removed @expo/config-plugins dependency.

Fixed

  • Fixed potential crash from unlockWithLicense if new architecture is enabled.

[3.2.0]

Changed

  • [react-native-imglysdk] Updated @expo/config-plugins dependency to 7.2.
  • [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for iOS version to 11.9.0.
  • [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for Android version to 10.9.0. See the migration guide for more information.
  • [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for iOS version to 11.9.0.
  • [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for Android version to 10.9.0. See the migration guide for more information.

Added

  • [react-native-imglysdk] Added kspVersion parameter.
  • [react-native-videoeditorsdk] Added VideoEditorResult to types export.
  • [react-native-photoeditorsdk] Added PhotoEditorResult to types export.

Fixed

  • Fixed compiling issues when using native customizations on iOS.
  • Fixed potential crash on Android: IllegalStateException "You need to use a Theme.AppCompat theme (or descendant) with this activity.".

[3.1.0]

Added

  • Added support for Expo 49. (#1811)

[3.0.0]

Changed

  • Changed and aligned the error codes for the modules.
  • [react-native-videoeditorsdk] Unlocking the SDK via VESDK.unlockWithLicense now returns a Promise<void>.
  • [react-native-photoeditorsdk] Unlocking the SDK via PESDK.unlockWithLicense now returns a Promise<void>.

Fixed

  • [react-native-videoeditorsdk] Fixed unused types exports.

[2.17.1]

Fixed

  • [react-native-imglysdk] Fixed wrong default SDK version for Android.

[2.17.0]

Added

  • Added configuration.singleToolMode that skips main menu if only one tool is used.
  • [react-native-videoeditorsdk] Added RNVideoEditorSDKModule.editorWillOpenClosure and RNVideoEditorSDKModule.editorWillExportClosure which allow further native configuration on Android.
  • [react-native-photoeditorsdk] Added RNPhotoEditorSDKModule.editorWillOpenClosure and RNPhotoEditorSDKModule.editorWillExportClosure which allow further native configuration on Android.

Fixed

  • [react-native-videoeditorsdk] Fixed VideoEditorResult.videoSize would always be zero.
  • [react-native-videoeditorsdk] Fixed error when not setting Configuration.export.video.segments.

[2.16.1]

Fixed

  • [react-native-videoeditorsdk] Fixed error when cancelling the editor.
  • [react-native-videoeditorsdk] Fixed missing export of VideoSegment type.
  • [react-native-videoeditorsdk] Fixed wrong types for VESDK.openEditor.

[2.16.0]

Added

  • [react-native-videoeditorsdk] Added duration action for text and stickers.
  • [react-native-videoeditorsdk] Added VideoEditorResult.segments, VideoEditorResult.videoSize, and VideoEditorResult.release() which enable serialization of the individual video composition components if configuration.export.video.segments is enabled.

[2.15.0]

Changed

  • 🚨 Bumped iOS deployment target to 13.0.
  • [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for iOS version to 11.1.0. See the changelog for more information.
  • [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for iOS version to 11.1.0. See the changelog for more information.

Added

  • Added implementation and documentation for background removal.

[2.14.0]

Added

  • [react-native-videoeditorsdk] Added implementation and documentation for GIPHY sticker integration.

Fixed

  • [react-native-videoeditorsdk] Fixed VESDK.openEditor return type declaration and API documentation to return Promise<VideoEditorResult | null> instead of just Promise<VideoEditorResult>.
  • [react-native-videoeditorsdk] Fixed height and width of specified composition size would be flipped on Android.
  • [react-native-photoeditorsdk] Fixed PESDK.openEditor return type declaration and API documentation to return Promise<PhotoEditorResult | null> instead of just Promise<PhotoEditorResult>.
  • [react-native-photoeditorsdk] Fixed deprecation warning for RCTBridge.imageLoader on iOS.

[2.13.1]

Fixed

  • Fixed enabling serialization would crash the application on Android when exporting.

[2.13.0]

Changed

  • 🚨 With this version you might need to create symlinks when using Android Gradle Plugin version 4.x. Please refer to the new known issues section of the README for details.
  • 🚨 This version requires minSdkVersion 21 for Android. Please refer to the new step 3 in the getting started section of the README for instructions on how to adjust it.
  • [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for Android version to 10.0.1. See the changelog for more information.
  • [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for Android version to 10.0.1. See the changelog for more information.

Added

  • [react-native-imglysdk] Added support to specify a custom buildToolsVersion, minSdkVersion, compileSdkVersion, targetSdkVersion, and kotlinGradlePluginVersion for Android with the Expo config plugin.

[2.12.0]

Changed

  • Unified changelog for react-native-photoeditorsdk, react-native-videoeditorsdk, and the new react-native-imglysdk.
  • Removed WRITE_EXTERNAL_STORAGE permission request when opening the editor on Android.
  • Aligned emoji support for iOS and Android. Emoji support is not optimized for cross-platform use and disabled by default. Added option configuration.text.allowEmojis to opt in.
  • Updated documentation for remote resources used in the editor. Remote resources are usable but not optimized and therefore should be downloaded in advance and then passed to the editor as local resources.

Added

  • Added integration and documentation for custom watermark.
  • [react-native-imglysdk] Added Expo config plugin. See the PE.SDK or VE.SDK getting started section of the README for instructions on how to use it.

Fixed

  • [react-native-videoeditorsdk] Fixed composition.personalVideoClips configuration option would not be resolved correctly on Android.

[2.11.0]

Changed

  • 🚨 The IMG.LY maven repository is no longer automatically added to your project by the plugin for Android. Please refer to the new step 3 in the getting started section of the README for instructions on how to add it.
  • [react-native-videoeditorsdk] Added support for VideoEditor SDK for Android version 9.
  • [react-native-photoeditorsdk] Added support for PhotoEditor SDK for Android version 9.

Added

  • Added configuration.export.force which will force the photo/video to be rendered and exported in the defined output format even if no changes have been applied. Otherwise, the input asset will be passed through and might not match the defined output format.
  • [react-native-videoeditorsdk] Added integration and documentation for force trim.

Fixed

  • [react-native-photoeditorsdk] Fixed export.image.exportType configuration option on iOS.

[2.10.1]

Fixed

  • Fixed compiling issues with compileSdkVersion 30 on Android.
  • [react-native-videoeditorsdk] Fixed video not being loaded when opening a single video without having video composition enabled in the license on Android.

[2.10.0]

Added

  • [react-native-videoeditorsdk] Added integration and documentation for new video library and audio library.

Fixed

  • [react-native-videoeditorsdk] Fixed crash when loading a serialization on Android.

[2.9.0]

Added

  • [react-native-videoeditorsdk] Added integration for new video composition tool on Android.

[2.8.0]

Added

  • [react-native-videoeditorsdk] Added integration and documentation for new video composition tool on iOS. Android support will be added in a later release.

[2.7.0]

Changed

  • Updated identifier documentation for replaced and new fonts.

Added

  • [react-native-videoeditorsdk] Added support to replace the VideoEditViewController with custom subclasses on iOS.
  • [react-native-photoeditorsdk] Added support to replace the PhotoEditViewController with custom subclasses on iOS.

[2.6.1]

Changed

  • [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for Android version to 8.0.8.
  • [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for Android version to 8.0.8.

[2.6.0]

Changed

  • [react-native-videoeditorsdk] Added support for VideoEditor SDK for Android version 8.0.4 and above.
  • [react-native-videoeditorsdk] Raised minimum VideoEditor SDK for Android version to 8.0.4.
  • [react-native-photoeditorsdk] Added support for PhotoEditor SDK for Android version 8.0.4 and above.
  • [react-native-photoeditorsdk] Raised minimum PhotoEditor SDK for Android version to 8.0.4.

[2.5.0]

Removed

  • 🚨 Removed createDefaultConfiguration as the created object is redundant with the Configuration documentation and it contains the options that are used per default when the editor is launched without a given configuration.

Added

  • Added integration and identifier documentation for new smart stickers.
  • [react-native-videoeditorsdk] Added integration and identifier documentation for new GIF sticker category and stickers.

[2.4.2]

Fixed

  • Fixed serialization export file URL to include the schema on Android.
  • [react-native-videoeditorsdk] Fixed crash when exporting serialization for remote videos on Android.
  • [react-native-videoeditorsdk] 🚨 Fixed export result type on Android to video which was image before.

[2.4.1]

  • [react-native-photoeditorsdk] Fixed wrong behavior of ImageExportType where DATA_URL and FILE_URL were swapped on Android.

[2.4.0]

Changed

  • 🚨 LUTFilter tile configurations are not parsed from the lutURI filename anymore and the default changed from a 8x8 to a 5x5 tile configuration on iOS. Please use the newly added configuration options to configure the tile layout independent of the filename.

Added

  • Added tile configuration options for LUTFilter.

[2.3.2]

Fixed

  • Fixed loading of static resources for release builds on Android.

[2.3.1]

Fixed

  • Fixed and updated getting started section of the readme for React Native versions older than 0.60.

[2.3.0]

Added

  • [react-native-videoeditorsdk] Added VideoEditorModal component that can be used instead of the VESDK.openEditor function to modally present a video editor.
  • [react-native-photoeditorsdk] Added PhotoEditorModal component that can be used instead of the PESDK.openEditor function to modally present a photo editor.

[2.2.2]

Fixed

  • Fixed default ordering of the frames for cross-platform consistency.

[2.2.1]

Fixed

  • Fixed possible archive issue for iOS with React Native versions older than 0.60.
  • Fixed "Can only use lower 16 bits for requestCode" exception on Android.

[2.2.0]

Added

  • [react-native-videoeditorsdk] Added an interface for native customization on iOS. Set the RNVideoEditorSDK.configureWithBuilder and RNVideoEditorSDK.willPresentVideoEditViewController properties of the bridge module to tweak VideoEditor SDK to your needs beyond the configuration options exposed to JavaScript.
  • [react-native-photoeditorsdk] Added an interface for native customization on iOS. Set the RNPhotoEditorSDK.configureWithBuilder and RNPhotoEditorSDK.willPresentPhotoEditViewController properties of the bridge module to tweak PhotoEditor SDK to your needs beyond the configuration options exposed to JavaScript.

Fixed

  • Fixed possible NPE if other native libraries register addActivityEventListener() on Android.

[2.1.2]

Fixed

  • Fixed possible compile issue with React Native versions older than 0.60 on Android.

[2.1.1]

Fixed

  • Fixed duplicate symbols for constants on iOS when using VideoEditor SDK and PhotoEditor SDK in the same project.
  • Fixed return null if the editor is dismissed without exporting the edited video on iOS.

[2.1.0]

Changed

  • [react-native-videoeditorsdk] Updated VideoEditor SDK for iOS to version 10.7.0.
  • [react-native-photoeditorsdk] Updated PhotoEditor SDK for iOS to version 10.7.0.

Fixed

  • Fixed automatic (CocoaPods) installation process for iOS so that VideoEditor SDK and PhotoEditor SDK can be used in the same project.
  • Fixed FRAMEWORK_SEARCH_PATHS for manual linking VideoEditor SDK on iOS which is required for React Native versions older than 0.60.
  • Add missing Platform import when using React Native versions older than 0.60.

[2.0.1]

Fixed

  • Fixed error message: "tools: replace" attribute that is linked to the "provider" element type is not bound on Android.

[2.0.0]

Added

  • [react-native-videoeditorsdk] Added support for VideoEditor SDK for Android version 7.1.5 and above.
  • [react-native-photoeditorsdk] Added support for PhotoEditor SDK for Android version 7.1.5 and above.

[1.3.0]

Changed

  • [react-native-videoeditorsdk] Updated VideoEditor SDK for iOS to version 10.6.0.
  • [react-native-photoeditorsdk] Updated PhotoEditor SDK for iOS to version 10.6.0.

[1.2.0]

Changed

  • [react-native-videoeditorsdk] Updated VideoEditor SDK for iOS to version 10.5.0.
  • [react-native-photoeditorsdk] Updated PhotoEditor SDK for iOS to version 10.5.0.

[1.1.0]

Added

  • Added configuration options for personal stickers.
  • [react-native-videoeditorsdk] Updated VideoEditor SDK for iOS to version 10.4.0.
  • [react-native-photoeditorsdk] Updated PhotoEditor SDK for iOS to version 10.4.0.

[1.0.2]

Fixed

  • Fixed unlockWithLicense.

[1.0.0]

Added

  • [react-native-videoeditorsdk] Initial release of the React Native module for VideoEditor SDK. This version adds support for iOS only. Android support will be added in a later release.
  • [react-native-photoeditorsdk] Initial release of the React Native module for PhotoEditor SDK. This version adds support for iOS only. Android support will be added in a later release.