88 StyleSheet ,
99 ScrollView ,
1010 ActivityIndicator ,
11+ TouchableOpacity ,
1112} from 'react-native' ;
1213import React , { useEffect , useState } from 'react' ;
1314import ImagePicker from 'react-native-image-crop-picker' ;
@@ -26,16 +27,17 @@ export default function TessrectModule() {
2627 } ) ;
2728 useEffect ( ( ) => {
2829 //recoginze text from remote image url
29- recognizeTextFromImage ( 'https://i.stack.imgur.com/0Jl54.png' ) ;
30+ // recognizeTextFromImage('https://i.stack.imgur.com/0Jl54.png');
3031 } , [ ] ) ;
3132
3233 const recognizeTextFromImage = async ( path ) => {
3334 console . log ( 'recognizeTextFromImage' ) ;
3435 try {
35- const recognizedText = await TesseractOcr . recognize ( path , 'hin@ eng' , { } ) ;
36+ const recognizedText = await TesseractOcr . recognize ( path , 'eng' , { } ) ;
3637 console . log ( 'test is' , recognizedText ) ;
3738 setresultText ( recognizedText ) ;
3839 } catch ( error ) {
40+ // error is [Error: java.io.FileNotFoundException: tessdata/eng.traineddata]
3941 console . log ( 'error is' , error ) ;
4042 }
4143 } ;
@@ -75,8 +77,15 @@ export default function TessrectModule() {
7577 padding : 20 ,
7678 } }
7779 >
78- < Text style = { { marginTop : 20 , fontSize : 22 } } >
79- Tesseract OCR React Native
80+ < Text
81+ style = { {
82+ marginTop : 20 ,
83+ fontSize : 18 ,
84+ fontWeight : '800' ,
85+ textAlign : 'center' ,
86+ } }
87+ >
88+ @devinikhiya/react-native-tesseractocr
8089 </ Text >
8190 < View
8291 style = { {
@@ -151,7 +160,7 @@ export default function TessrectModule() {
151160 < Text
152161 style = { {
153162 backgroundColor : '#fff' ,
154-
163+ borderColor : '#888' ,
155164 borderTopRightRadius : 8 ,
156165 borderTopLeftRadius : 8 ,
157166 padding : 20 ,
@@ -161,14 +170,27 @@ export default function TessrectModule() {
161170 >
162171 { resultText }
163172 </ Text >
164- < Button
173+ < TouchableOpacity
165174 onPress = { ( ) => handleCopy ( ) }
166175 style = { {
167176 marginTop : 20 ,
168- marginLeft : 'auto' ,
177+ padding : 10 ,
178+ backgroundColor : '#c3c3c3' ,
179+ borderRadius : 8 ,
180+ alignSelf : 'center' ,
169181 } }
170182 title = "Copy Text"
171- />
183+ >
184+ < Text
185+ style = { {
186+ color : '#000' ,
187+ fontWeight : '600' ,
188+ paddingHorizontal : 30 ,
189+ } }
190+ >
191+ Copy Text
192+ </ Text >
193+ </ TouchableOpacity >
172194 </ View >
173195 ) }
174196 </ ScrollView >
@@ -177,13 +199,13 @@ export default function TessrectModule() {
177199
178200const styles = StyleSheet . create ( {
179201 featureItem : {
180- marginTop : 10 ,
181202 flex : 1 ,
182203 padding : 10 ,
183- paddingVertical : 30 ,
184204 margin : 5 ,
205+ marginTop : 50 ,
185206 borderRadius : 12 ,
186207 flexDirection : 'column' ,
187208 alignContent : 'center' ,
209+ backgroundColor : 'lightgrey' ,
188210 } ,
189211} ) ;
0 commit comments