react-native-sketch-canvas-enhanced
Version:
Enhanced react-native-sketch-canvas with shape drawing tools and advanced text annotations. Draw, sketch, and annotate on both iOS and Android devices.
97 lines (96 loc) • 3.05 kB
TypeScript
import React from 'react';
import SketchCanvas from './SketchCanvas';
import type { RNSketchCanvasProps, PathData, CanvasText, ShapeType } from './types';
type CanvasState = {
color: any;
strokeWidth: any;
alpha: string;
drawMode: 'draw' | ShapeType;
shapeFilled: boolean;
textEditing: boolean;
currentText: CanvasText | null;
pendingTextMode: boolean;
};
export default class RNSketchCanvas extends React.Component<RNSketchCanvasProps, CanvasState> {
static defaultProps: {
containerStyle: null;
canvasStyle: null;
onStrokeStart: () => void;
onStrokeChanged: () => void;
onStrokeEnd: () => void;
onShapeStart: () => void;
onShapeChanged: () => void;
onShapeEnd: () => void;
onTextTapped: () => void;
onTextEditingComplete: () => void;
onClosePressed: () => void;
onUndoPressed: () => void;
onClearPressed: () => void;
onPathsChange: () => void;
onShapesChange: () => void;
user: null;
closeComponent: null;
eraseComponent: null;
undoComponent: null;
clearComponent: null;
saveComponent: null;
strokeComponent: null;
strokeSelectedComponent: null;
strokeWidthComponent: null;
lineComponent: null;
rectangleComponent: null;
circleComponent: null;
arrowComponent: null;
shapeFilledComponent: null;
textComponent: null;
textEditComponent: null;
strokeColors: {
color: string;
}[];
alphlaValues: string[];
defaultStrokeIndex: number;
defaultStrokeWidth: number;
minStrokeWidth: number;
maxStrokeWidth: number;
strokeWidthStep: number;
defaultDrawMode: string;
defaultShapeFilled: boolean;
savePreference: null;
onSketchSaved: () => void;
text: null;
localSourceImage: null;
permissionDialogTitle: string;
permissionDialogMessage: string;
};
_colorChanged: boolean;
_strokeWidthStep: any;
_alphaStep: any;
_sketchCanvas: any;
static MAIN_BUNDLE: any;
static DOCUMENT: any;
static LIBRARY: any;
static CACHES: any;
constructor(props: RNSketchCanvasProps);
clear(): void;
undo(): any;
addPath(data: PathData): void;
deletePath(id: any): void;
save(): void;
getBase64(imageType: string, transparent: boolean, includeImage: boolean, includeText: boolean, cropToImageSize: boolean, callback: () => void): any;
nextStrokeWidth(): void;
_renderItem: ({ item, index }: {
item: any;
index: any;
}) => React.JSX.Element;
componentDidUpdate(): void;
addText(position: {
x: number;
y: number;
}): number;
setDrawMode(mode: 'draw' | ShapeType): void;
toggleShapeFilled(): void;
handleTextEditingComplete(text: CanvasText): void;
render(): React.JSX.Element;
}
export { SketchCanvas };
export * from './types';