Skip to main content

Types

All types are exported from @phucprime/react-native-image-editor.

import type {
ImageEditorConfig,
ImageEditorLanguage,
EditorControl,
} from '@phucprime/react-native-image-editor';

ImageEditorConfigโ€‹

The configuration object passed to ImageEditor.open() and ImageEditor.edit().

interface ImageEditorConfig {
path: string;
colors?: string[];
stickers?: string[];
hiddenControls?: EditorControl[];
languages?: ImageEditorLanguage;
onDone?: (imagePath: string) => void;
onCancel?: (resultCode: number) => void;
}

Fieldsโ€‹

path โ€” string ยท requiredโ€‹

Local filesystem path (or file:// URI) of the image to edit. The editor overwrites this file when the user taps Done. See the File Paths guide.

path: 'file:///var/mobile/Containers/Data/Application/.../photo.jpg'
path: '/data/user/0/com.myapp/files/photo.jpg'

colors โ€” string[] ยท optionalโ€‹

Array of hex color strings for the drawing and text colour picker. Accepts #RGB, #RRGGBB, and #AARRGGBB.

colors: ['#e74c3c', '#f39c12', '#2ecc71', '#3498db', '#9b59b6']

Default: 13-colour built-in palette โ€” see ImageEditor defaults.


stickers โ€” string[] ยท optionalโ€‹

Array of sticker image names (no extension) matching native resource names. iOS: main bundle images. Android: res/drawable/ names.

stickers: ['sticker_heart', 'sticker_star', 'sticker_fire']

Default: []. See the Stickers guide.


hiddenControls โ€” EditorControl[] ยท optionalโ€‹

Controls to remove from the editor toolbar.

hiddenControls: ['share', 'clear']

Default: []. See Hidden Controls guide.


languages โ€” ImageEditorLanguage ยท optionalโ€‹

Partial UI string overrides. Unset keys fall back to English.

languages: { doneTitle: 'Finish', saveTitle: 'Save to Gallery' }

Default: English. See Localization guide.


onDone โ€” (imagePath: string) => void ยท optionalโ€‹

Called after the edited image is saved. imagePath is the file path that was written. Not used with ImageEditor.edit().


onCancel โ€” (resultCode: number) => void ยท optionalโ€‹

Called when the user dismisses without saving. Not used with ImageEditor.edit().


ImageEditorLanguageโ€‹

All fields are optional. Unset fields fall back to the English defaults listed below.

interface ImageEditorLanguage {
doneTitle?: string; // default: 'Done'
saveTitle?: string; // default: 'Save'
clearAllTitle?: string; // default: 'Clear all'
cameraTitle?: string; // default: 'Camera'
galleryTitle?: string; // default: 'Gallery'
uploadDialogTitle?: string; // default: 'Upload Image'
uploadPickerTitle?: string; // default: 'Select Picture'
directoryCreateFail?: string; // default: 'Failed to create directory'
accessMediaPermissionsMsg?: string;
continueTxt?: string; // default: 'Continue'
notNow?: string; // default: 'NOT NOW'
mediaAccessDeniedMsg?: string;
saveImageSucceed?: string; // default: 'Image saved'
eraserTitle?: string; // default: 'Eraser'
}

Field referenceโ€‹

KeyDefault (English)Where it appears
doneTitleDoneEditor toolbar โ€” main action button
saveTitleSaveSave-to-gallery button (Android)
clearAllTitleClear allClear/undo all edits button
cameraTitleCameraCamera option in image picker
galleryTitleGalleryGallery option in image picker
uploadDialogTitleUpload ImageSticker upload dialog title
uploadPickerTitleSelect PictureSticker source picker title
directoryCreateFailFailed to create directoryError toast when storage write fails
accessMediaPermissionsMsgTo attach photos, we need to access media on your devicePermission rationale dialog body
continueTxtContinuePermission rationale โ€” confirm button
notNowNOT NOWPermission rationale โ€” dismiss button
mediaAccessDeniedMsgYou denied storage access, no photos will be added.Toast shown when permission is denied
saveImageSucceedImage savedSuccess toast after save-to-gallery
eraserTitleEraserEraser tool label

EditorControlโ€‹

A union of the control names that can be hidden via hiddenControls.

type EditorControl =
| 'text' // Text overlay tool
| 'clear' // Clear all edits
| 'draw' // Freehand brush tool
| 'save' // Save-to-gallery button (Android)
| 'share' // Share image button
| 'sticker' // Sticker picker
| 'crop'; // Crop tool

Deprecated typesโ€‹

These are exported for backward compatibility with pre-1.0 code. Prefer the canonical names above.

/** @deprecated Use ImageEditorConfig */
type PhotoEditorProps = ImageEditorConfig;

/** @deprecated Use ImageEditorLanguage */
type Language = ImageEditorLanguage;