ideacreation / react-native-barcodescanner

A barcode scanner component for react native - not maintained anymore - use react-native-camera
MIT License
538 stars 162 forks source link

Extremely bad performance #53

Closed morigs closed 4 years ago

morigs commented 8 years ago

When using JS FPS is always 0, and the app so slow. Any thoughts?

lecramfriedrich commented 8 years ago

I think it was already discussed on Issue https://github.com/ideacreation/react-native-barcodescanner/issues/46.

My setup is:

It was working for me first, but than i ran into the same Performance problems again.

I am using react-native-router-flux. The following problem appears:

Now im back to 2 FPS again and Navigation pop and push is laggy as hell. I think it's somehow connected to the onHostResume function from BarcodeScannerManager

Maybe @andreaskeller has an Idea.

morigs commented 8 years ago

I use react native Navigator. But barcode scene is initial. I don't through Scenes or put app in background.

andreaskeller commented 8 years ago

I just got an Nexus 5X with Android 6.0.1 and experience the same performance problems. On my older HTC One with Android 4.4 up to 5.5 recently everything was much faster. I am looking into it.

AlexSchwabauer commented 8 years ago

I opened a pull request #55 which should solve the problem by using AsyncTask so the UI thread is not blocked.

morigs commented 8 years ago

@AlexSchwabauer i don't know java so can't review PR. But it works fine on my phone for now! :relieved: screenshot_20160915-214005

AlexSchwabauer commented 8 years ago

@gogamwar Great! I still would recommend to use InteractionManager.runAfterInteractions to mount the component only after all animations are done, since the initial startup is quite heavy. Having state.showBarcodeScanner initially set to false and then

componentDidMount = () => { InteractionManager.runAfterInteractions(() => { this.setState({showBarcodeScanner:true}) }); }

would to the job.

badaz commented 7 years ago

Thanks a lot !