React-native-image-crop-picker: Android reset app on camera/gallery open

Created on 14 Nov 2017  路  8Comments  路  Source: ivpusic/react-native-image-crop-picker

Version

  • react-native-image-crop-picker v0.13.1
  • react-native v0.42.0

Platform

  • Android

Expected behaviour

Should open camera or image gallery, allow user to crop the image, and return to last screen of app to continue with processing of

Actual behaviour

Opening camera/image gallery, allows user to crop the image but then app resets entirely. Shows the launch image (indicating that the app is loading) and then goes to the first scene of the app.

Most helpful comment

@sabbyt54 ,i have find the problem.please check Settings->Developer options->Apps->Don't keep activities is open.if this option is checked/open ,then the rn app will restart/reset when the app go to background.best regards.

All 8 comments

can you provide application stacktrace or any other useful debugging information?

i have the same problem,my device is Nexus 5 with Android 6.0.1 .but on another device with Android 4.2 is ok.
strack trace
E/WindowManager: android.view.WindowLeaked: Activity com.tianshibo.MainActivity has leaked window com.android.internal.policy.PhoneWindow$DecorView{ff0827f V.E...... R....... 0,0-1080,1920} that was originally added here at android.view.ViewRootImpl.<init>(ViewRootImpl.java:368) at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:299) at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:85) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3169) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481) at android.app.ActivityThread.-wrap11(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) at android.os.Handler.dispatchMessage(Handler.java:102) at android.os.Looper.loop(Looper.java:148) at android.app.ActivityThread.main(ActivityThread.java:5417) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
@ivpusic

classpath 'com.android.tools.build:gradle:2.2.3'
react-native v0.44.0
react-native-image-crop-picker v0.13.1

just call ImagePicker.openPicker,then press back button,the app will restart/reload

@sabbyt54 ,i have find the problem.please check Settings->Developer options->Apps->Don't keep activities is open.if this option is checked/open ,then the rn app will restart/reset when the app go to background.best regards.

@itneste 's solution works for me, on your device or emulator go to Settings->Developer options->Apps->Don't keep activities and turn it off.

@ivpusic I think this should be in the installation instructions

same issue on Redmi devices.

@itneste 's solution works for me, on your device or emulator go to Settings->Developer options->Apps->Don't keep activities and turn it off.

@ivpusic I think this should be in the installation instructions

its not a solution.. in prod mode to.

the company suggests that you need to save the state at the time of onStop, and restore it on onCreate. in MainActivity, but I don't have the code. for those who do not know what to do, there is a solution without using this library. You can output a stream from the camera directly to the react-native app using react-native-camera. And to get photos from the library and crop them, use this library.

Was this page helpful?
0 / 5 - 0 ratings