Data file not found - react-native

I am making react native app with tesseract ocr. When I add image using react native image picker our gives me error:
OCR Error: [Error: Data file not found at /storage/emulated/0/com.textrecognition/tessdata/eng.traineddata]
But I have created folder assets/tessdata in android/app/src/main/assets/tessdata and there I put my file, what am I doing wrong?

Related

Adding #bam.tech/react-native-batch to a fresh new react native project does not work

I try to yarn add #bam.tech/react-native-batch but I got the following error:
node_modules/#bam.tech/react-native-batch/android/src/main/java/tech/bam/RNBatchPush/RNUtils.java:113: error: no suitable method found for put(String, batchEventData.put(key, URI.create(valueMap.getString("value")));
and
node_modules/#bam.tech/react-native-batch/android/src/main/java/tech/bam/RNBatchPush/RNBatchModule.java:529: error: no suitable method found for setAttribute(String, editor.setAttribute(key, URI.create(url));
while doing yarn android (no error on iOS)
I am using react 18 and *react-native 0.69.1

React Native - How to upload Audio files with spaces in their names

I have successfully been able to upload file when the filename is just one word, When there are spaces in the name, the file, I get error from server.
Example: 1.] '.../musics/Love.m4a' -> upload successfully
2] '.../musics/Love Thy Neighbor.m4a' -> upload failed
Any idea on how to handle this issue in React native will be highly appreciated.
I have been trying to upload an audio file in react-native but because of space in file name not being able to upload to server, I get below error from a server;
**file:** {uri: 'file:///Users/fathom-d004/Library/Developer/CoreSi…m.brandarmy.user1-Inbox/Love%20Thy%20Neighbor.m4a',
name: 'Love Thy Neighbor.m4a', type: 'audio/x-m4a'}
error: Error: ENOENT: no such file or directory, open '/Users/fathom-d004/Library/Developer/CoreSimulator/Devices/83619055-D45F-4FA9-85CC-A2009A599EA7/data/Containers/Data/Application/FE596B31-0385-4F77-B342-EF354F86FF1B/tmp/com.brandarmy.user1-Inbox/Love%2520Thy%2520Neighbor.m4a'
Used below simple solution;
I believe I've found the error. The issue was that the file I was uploading had a space in it, so we need to decode the URL first before uploading file to server, like:
var decodedURL = decodeURIComponent(file.uri);
const base64 = await fs.readFile(decodedURL, "base64");
Thanks...!

react native expo how to require an image?

I'm learning react native expo
I want to require an image from assets/images
The image I want to require is noti.png
I got this error
What am i missing?
You are passing the location of the image incorrectly. as you can see in the error: the module .. could not be found
To fix it, check the location of current file you are calling that image then go back to the exact location and call it. Also If you are using IDE they recommend you the location.
Update:
require('../assets/images/noti.png'

Unable to resolve module (Expo, React Native)

Building a React Native app with Expo, the Javascript bundle fails after getting the error Unable to resolve "../stores/__fixtures__/matchlist/matchlistSourceFixture" from "src/containers/MatchlistSwipeContainer.tsx", despite the fact that I am 100% sure this file exists and its relative path in this instance is correct – especially as I’m using VSCode and it complains if the path isn’t right and I’m using VSCode’s autocomplete to begin with.
If I move the file into any other directory that is not with __ dunder affixes and update the relative path accordingly, it can find the file perfectly fine.
I’ve checked other similar topics with Unable to resolve module errors, but they all seem to be related to third-party packages, whereas this is a local file.
Import statement:
import { matchlistSourceFixture } from '../stores/__fixtures__/matchlist/matchlistSourceFixture';
Export statement in the file in matchlistSourceFixture.ts:
export const matchlistSourceFixture = {...}
Attached is an image of the error message in the Expo iOS app. The message stating that the file doesn’t even exist (it has a .ts extension by the way) makes me think the relative path isn’t really the issue here anyway.
Versions:
React 16.3.1
Expo 27.0.0
Exp 54.0.0
It seems like __fixtures__ dirs are blacklisted by default in RN: react-native/local-cli/util/Config.js.
See this comment on overriding the default.

React Native Image Load Error

I'm trying to load these specific images using the following uri: https://image.tmdb.org/t/p/w500/zkXnKIwX5pYorKJp2fjFSfNyKT0.jpg
https://image.tmdb.org/t/p/w500/bbxtz5V0vvnTDA2qWbiiRC77Ok9.jpg
The onError event throws the following error:
Error decoding image data
The images loads correctly in safari and chrome. Any ideas what could be wrong? How can I debug this furthur? Other Images are loading correctly, but these specific images throws these error.
RN 0.41
Platform: iOS
download the images and use them in requie("//address of the image in your project")