Comments (15)
@badbeoti
Thanks for sharing the code snippet. We will let you know if this issue is fixed.
from capture-vision-react-native-samples.
Your change is correct.
from capture-vision-react-native-samples.
As you can see occur severe hang when call getTimeOfDay.
This timing is same that await this.reader.startScanning()
.
And I have some question.
- Should i create instance and addResultListener every single time to scan barcode?
- If the above is correct, Should i stopScanning and removeAllResultListeners after scan barcode every time?
- I tried to Profiling from xCode. And i found so many thread for using DynamsoftBarcode or DynamsoftCamera. Is it right? Please tell me if I'm using it wrong.
Currently experiencing inconvenience due to bugs.
Anyway, I want you guys to solve it quickly.
from capture-vision-react-native-samples.
@Dynamsoft-Henry
Can you check please.
from capture-vision-react-native-samples.
Working on it now
from capture-vision-react-native-samples.
Hi @badbeoti
For the 3 questions:
Question:
- Should i create instance and addResultListener every single time to scan barcode?
- If the above is correct, Should i stopScanning and removeAllResultListeners after scan barcode every time?
Answer:
What do you mean by "every single time" actually? You can addResultListener
before the first-time barcode scanning. You don't need to always addResultListener
or removeAllResultListeners
during the video previewing. If you want to stop scanning the barcodes but not going to close the camera, please use the method stopScanning
. When you have to trigger removeAllResultListeners
is the time you want to leave the camera view page and close the camera.
Question:
- I tried to Profiling from xCode. And i found so many thread for using DynamsoftBarcode or DynamsoftCamera. Is it right? Please tell me if I'm using it wrong.
Answer:
"So many threads" is not a problem. At least, we also have that many threads when running our sample. This is not the reason for the hang.
Based on the code snippet, there are some suggestions from our developer.
We suggest you to make some modifications on the "useEffect":
useEffect(() => {
if (reader) {
// @ts-ignore
console.log(router.params.key, 'Scan');
console.log(reader, 'Scan');
(async () => {
try {
loaderStore.setLoading(true);
console.log(router.params.key, 'reader.startScanning start');
await reader.startScanning();
console.log(router.params.key, 'reader.startScanning end');
loaderStore.setLoading(false);
// move you code of addResultListener from takeScreenShotAndBarcode to this place.
reader.addResultListener(async (data) => {
if (data) {
const regularize = regularizeResults(data);
if (regularize.length > 0) {
// remove the removeAllResultListener here.
// reader.removeAllResultListeners();
if (router.params.withImage) {
// remove the clear() here
// await clear();
// NOTE: react-native-view-shot
// 해당 라이브러리는 ios 환경을 캡쳐할 수 없는 이슈
if (Platform.OS === 'ios') {
goPrevRoute(regularize[0].trim(), false);
} else {
goPrevRoute(regularize[0].trim(), true, url);
}
} else {
await reader.stopScanning();
// remove the clear() here
//await clear();
goPrevRoute(regularize[0].trim(), false);
}
}
}
});
} catch (e) {
console.log(e);
}
})();
//
} else {
(async () => {
loaderStore.setLoading(true);
await createReader();
loaderStore.setLoading(false);
})();
}
// Add the following code
return () => {
await clear();
}
}, []);//Leave the second parameter of useEffect empty
We can't run your code snippet because it seems to be not completed and includes some third-party components. We are not sure whether the above suggestions can solve your issue.
from capture-vision-react-native-samples.
The following question we can't understand. Are there any relations between getTimeOfDay and our startScanning?
As you can see occur severe hang when call getTimeOfDay.
This timing is same that await this.reader.startScanning().
from capture-vision-react-native-samples.
First, We fixed the problem by modifying the DYSCameraView.m
Can you check this code got no problem?
And "What it's mean every single time". You need to know multiple scan page we have.
We use many Scan
page each has unique key value(and it is new created every single time).
So, User can visit different Scan
page. and it can happen in a very short time.
Test attempted without addResultListener
and removeAllResultListeners
.
It had only left DCVCameraView
.
const Scan = observer(() => {
return (
<Layout collapsable={false}>
<DCVCameraView
style={{flex: 1, justifyContent: 'space-between'}}
ref={DCVRef}
overlayVisible={true}
// @ts-ignore
torchButton={{visible: true}}
torchState={EnumTorchState.OFF}
scanRegionVisible={true}
scanRegion={ScanRegion}
>
</DCVCameraView>
</Layout>
);
});
export default Scan;
And we got same result(severe hang).
We also tried a different code. Similar to what you suggested like clearFn inside useEffect()
But we got same result again.
We checked the error log more accurately using Sentry.
We can found __psynch_mutexwait
when we got severe hang.
I think it's not problem in react-native
cause it happen only iOS.
I'm not iOS developer. I don't know exactly but you guys something seems to have set the mutex wrong.
If not maybe we used this wrong.
if ([StaticClass instance].dce == nil) {
[StaticClass instance].dce = [[DynamsoftCameraEnhancer alloc] init];
}
Anyway we solve problem use this.
[StaticClass instance].dce = [[DynamsoftCameraEnhancer alloc] init]
only one time.
If this way is wrong choice. Please leave a comment.
Thx.
from capture-vision-react-native-samples.
@Dynamsoft-Henry
Any release plan for this fix?
from capture-vision-react-native-samples.
@badbeoti
If possible, can you please create a PR for this fix?
from capture-vision-react-native-samples.
Actually which version are you working on? Our latest version is v1.1.12. Would you like to try the latest version? Our developers said they have fixed this issue in the v1.1.12 version.
"dynamsoft-capture-vision-react-native": "^1.1.12",
from capture-vision-react-native-samples.
from capture-vision-react-native-samples.
@tousif-p99soft
Thanks, we will check it again.
from capture-vision-react-native-samples.
@tousif-p99soft
Would you like to send us your simplified project or code snippet to show us how you are using the SDK.
Since we can't reproduce the frozen. We need your code snippet to make more tests so that we can confirm the bugs are fixed before release.
from capture-vision-react-native-samples.
@tousif-p99soft
If possible, would you like to share your package.json file with us?
from capture-vision-react-native-samples.
Related Issues (13)
- Task :app:mergeDebugAssets FAILED
- DCVCameraView component not working HOT 10
- CocoaPods could not find compatible versions for pod "DynamsoftBarcodeReader" HOT 2
- DCVCameraView styling support HOT 10
- Document scanner HOT 4
- dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx typescript definition incompatible with RN 0.70.6 HOT 7
- iOS simulator stuck in SplashScreen - [email protected] HOT 6
- Camera permission on launch - ios HOT 1
- App frozen HOT 13
- DCVCameraView will get stuck after multiple times of render HOT 9
- Dynamsoft library not built for ARM64 HOT 6
- Adding beep sound to react-native Dynamsoft library HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capture-vision-react-native-samples.