expo-dynamic-image-crop
Version:
Dynamic image cropping component for Expo/React Native with free-form and fixed aspect ratio support
82 lines • 2.87 kB
TypeScript
import { EditorOptions } from "./types";
interface ImageData {
uri: string;
width: number;
height: number;
}
interface ImageBounds {
x: number;
y: number;
width: number;
height: number;
}
interface Pan {
x: number;
y: number;
}
interface CropSize {
width: number;
height: number;
}
/**
* Internal Zustand store for the image editor
*
* WARNING: This store is for internal use only.
* Direct access to this store is not recommended for most users.
*
* For safe, read-only access to editor state, use the hooks from:
* - useEditorProcessing()
* - useEditorReady()
* - useEditorImageData()
* - useEditorMode()
* - useEditorCropInfo()
*
* These hooks provide a stable API that won't break with internal changes.
*/
export interface EditorStore {
/** Current image data - use useEditorImageData() for safe access */
imageData: ImageData;
/** Internal setter - do not use directly */
setImageData: (data: ImageData) => void;
/** Internal scale factor - do not use directly */
imageScaleFactor: number;
/** Internal setter - do not use directly */
setImageScaleFactor: (factor: number) => void;
/** Image bounds - use useEditorCropInfo() for safe access */
imageBounds: ImageBounds;
/** Internal setter - do not use directly */
setImageBounds: (bounds: ImageBounds) => void;
/** Ready state - use useEditorReady() for safe access */
ready: boolean;
/** Internal setter - do not use directly */
setReady: (ready: boolean) => void;
/** Processing state - use useEditorProcessing() for safe access */
processing: boolean;
/** Internal setter - do not use directly */
setProcessing: (processing: boolean) => void;
/** Accumulated pan - use useEditorCropInfo() for safe access */
accumulatedPan: Pan;
/** Internal setter - do not use directly */
setAccumulatedPan: (pan: Pan) => void;
/** Crop size - use useEditorCropInfo() for safe access */
cropSize: CropSize;
/** Internal setter - do not use directly */
setCropSize: (size: CropSize) => void;
/** Editing mode - use useEditorMode() for safe access */
editingMode: string;
/** Internal setter - do not use directly */
setEditingMode: (mode: string) => void;
/** Edit state - use useEditorMode() for safe access */
isEdit: boolean;
/** Internal setter - do not use directly */
setIsEdit: (isEdit: boolean) => void;
/** Editor options */
editorOptions: EditorOptions;
/** Internal setter - do not use directly */
setEditorOptions: (options: EditorOptions) => void;
/** Internal method - do not use directly */
resetEditorStore: () => void;
}
export declare const useEditorStore: import("zustand").UseBoundStore<import("zustand").StoreApi<EditorStore>>;
export {};
//# sourceMappingURL=store.d.ts.map