React-native-image-crop-picker: Opening imagePicker from modal button freezes

Created on 26 Mar 2018  路  7Comments  路  Source: ivpusic/react-native-image-crop-picker

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.20.0
  • react-native v0.54.2

Platform

Tell us to which platform this issue is related

-> iOS

  • Android

Expected behaviour

Click on button in react-native-modal
modal close
imagepicker open

Actual behaviour

Click on button in react-native-modal
modal close
imagepicker open
imagepicker closes immidietly
modal stays on top of everything
screen is freeze

Steps to reproduce

I'm opening imagepicker from react-native-modal.
After user clicks on the button inside react-native-modal. I want to hide the modal and then open image picker.

If I close modal after closing imagepicker no error occured.
It looks like closing of modal and immediately opening the imagepicker conflicting.

Attachments

// stacktrace or any other useful debug info

Love react-native-image-crop-picker? Please consider supporting our collective:
馃憠 https://opencollective.com/react-native-image-crop-picker/donate

Most helpful comment

We had he same problem.
See https://github.com/ivpusic/react-native-image-crop-picker/issues/264.
Basically, before opening the picker form modal, dismiss the modal and wait 200 ms.
There is a bug in RN when both a modal and native Alert dialog are shown

All 7 comments

We had he same problem.
See https://github.com/ivpusic/react-native-image-crop-picker/issues/264.
Basically, before opening the picker form modal, dismiss the modal and wait 200 ms.
There is a bug in RN when both a modal and native Alert dialog are shown

Any update on this issue? Waiting for a predefined time seems pretty hacky.

We had to do something similar, placing some image picker logic behind a setTimeout. Definitely looking to migrate to a different framework.

I had to do some thing solve this problem in iOS.
I got the tag in the react code銆侫nd then remove the view in the iOS code.
And it seem to be works for me.

This problem is only in ios but in android its work properly. So to solve this problem in ios, i need to keep at least 320ms waiting to work in ios.
I did this way.

const wait = new Promise((resolve) => setTimeout(resolve, 320)); Platform.OS === 'ios' ? wait.then(() => kamera()) : kamera();

Using a delay is hackish and doesn't account for custom animation on modals. The proper fix around this is to trigger the imagePicker until after the modal was hidden.

See https://reactnative.dev/docs/modal#ondismiss or onModalHide for https://github.com/react-native-community/react-native-modal

Using a delay is hackish and doesn't account for custom animation on modals. The proper fix around this is to trigger the imagePicker until after the modal was hidden.

See https://reactnative.dev/docs/modal#ondismiss or onModalHide for https://github.com/react-native-community/react-native-modal

thx... work for me

Was this page helpful?
0 / 5 - 0 ratings