import { requireNativeModule } from "expo"; interface Rect { left: number; top: number; right: number; bottom: number; } interface TextElement { text: string; frame: Rect; recognizedLanguages: string[]; } interface TextLine { text: string; frame: Rect; recognizedLanguages: string[]; elements: TextElement[]; } interface Block { text: string; frame: Rect; recognizedLanguages: string[]; lines: TextLine[]; } interface Text { text: string; blocks: Block[]; } interface RNMLKitTextRecognitionModule { recognizeText: (imagePath: string) => Promise; } const textRecognitionModule = requireNativeModule( "RNMLKitTextRecognition" ); async function recognizeText(imagePath: string): Promise { return await textRecognitionModule.recognizeText(imagePath); } export { recognizeText }; export type { Text, Block, TextLine, TextElement, Rect };