Editing & Markup
iOS Only
Editing and markup features are only available on iOS via QLPreviewController.
Control whether users can edit files during preview using the editingMode option.
Editing Modes
| Mode | Behavior | Event Fired |
|---|---|---|
'disabled' | Read-only preview (default) | onDismiss only |
'createCopy' | Edits are saved to a new file | onSavedEditedCopy |
'updateContents' | Edits modify the original file | onEditedFile |
Create Copy
Edits are saved to a new file, leaving the original untouched:
await ExpoQuickLook.previewFile({
uri: '/path/to/image.png',
editingMode: 'createCopy',
});
Listen for the saved copy:
const subscription = ExpoQuickLook.addListener(
'onSavedEditedCopy',
(event) => {
console.log('Original:', event.originalPath);
console.log('Edited copy:', event.editedPath);
// Preview the edited copy
ExpoQuickLook.previewFile({ uri: event.editedPath });
}
);
Update Contents
Edits modify the original file in place:
await ExpoQuickLook.previewFile({
uri: '/path/to/image.png',
editingMode: 'updateContents',
});
Listen for edits:
const subscription = ExpoQuickLook.addListener(
'onEditedFile',
(event) => {
console.log('File modified:', event.filePath);
}
);
Event Flow
- User opens preview — no event
- User taps the markup button and makes edits
- User taps "Done"
createCopy→onSavedEditedCopyfires with both pathsupdateContents→onEditedFilefires with the file path
- User dismisses preview →
onDismissfires
Always clean up listeners:
// In a React component
useEffect(() => {
const sub = ExpoQuickLook.addListener('onSavedEditedCopy', handler);
return () => sub.remove();
}, []);