diff --git a/react-native-mlkit-ocr/Test/OcrTest.tsx b/react-native-mlkit-ocr/Test/OcrTest.tsx new file mode 100644 index 00000000..d376a180 --- /dev/null +++ b/react-native-mlkit-ocr/Test/OcrTest.tsx @@ -0,0 +1,160 @@ +import React from 'react'; +import { TestSuite, TestCase, Tester } from '@rnoh/testerino'; +import { + StyleSheet, + View, + TouchableHighlight, + SafeAreaView, + Text, + ActivityIndicator, +} from 'react-native'; +import MlkitOcr, { MlkitOcrResult } from 'react-native-mlkit-ocr'; + +const PALETTE = { + REACT_CYAN_LIGHT: 'hsl(193, 95%, 68%)', + REACT_CYAN_DARK: 'hsl(193, 95%, 30%)', +} + +function Button({ label, onPress }: { onPress: () => void; label: string }) { + return ( + + + {label} + + + ); +} + +const styles = StyleSheet.create({ + container: { + flex: 1, + justifyContent: 'center', + }, + scroll: { + flex: 1, + width: '100%', + borderColor: '#ccc', + borderWidth: 2, + height: '70%', + }, +}); + +export const OcrTest = () => { + const [loading, setLoading] = React.useState(false); + const [result, setResult] = React.useState(); + + if (loading) { + return ( + + + + ); + } + return ( + + + + {Array.isArray(result) && result?.length && ( + + {result?.map((block) => { + console.log("=================result>", JSON.stringify(result)); + console.log("=================block>", JSON.stringify(block)); + + return block.lines.map((line) => { + return ( + + {line.text} + + ); + }); + })} + + )} + + + { + return ( + +