Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select the picture in the callback event, open the selected picture and automatically close it immediately #6

Open
276259822 opened this issue May 12, 2021 · 9 comments
Assignees
Labels
enhancement New feature or request

Comments

@276259822
Copy link

276259822 commented May 12, 2021

import ImagePicker from "react-native-image-crop-picker"

<ActionSheet
  ref={actionSheetRef}
  title="Please Select Picture"
  options={[
    "Camera",
    "Library",
    "Cancel",
  ]}
  cancelButtonIndex={2}
  onPress={onPress}
/>

const onPress = index => {
  if (index === 1) {
    ImagePicker.openCamera({
      mediaType: "photo",
      width: 300,
      height: 400,
      compressImageMaxWidth: 750,
      compressImageQuality: 0.7,
      cropping: true,
    })
  }
}
1639533228054345.mp4

@alessiocancian

@276259822 276259822 added the bug Something isn't working label May 12, 2021
@wanderlust252
Copy link

i have this issue too. I think we have to handle close modal event

@alessiocancian
Copy link
Owner

Can you provide more info about the issue?
What you expect to happen and what happens instead?

@276259822 @wanderlust252

@wanderlust252
Copy link

wanderlust252 commented May 31, 2021

Can you provide more info about the issue?
What you expect to happen and what happens instead?

@276259822 @wanderlust252

i fix this function like this. I handle when i wanna hide actionSheet by Ref in parent view. Close actionsheet right after image picker respone
image
image

@alessiocancian alessiocancian added enhancement New feature or request and removed bug Something isn't working labels Jun 1, 2021
@alessiocancian
Copy link
Owner

Can you provide more info about the issue?
What you expect to happen and what happens instead?
@276259822 @wanderlust252

i fix this function like this. I handle when i wanna hide actionSheet by Ref in parent view. Close actionsheet right after image picker respone
image
image

Ok so the problem is that currently when an option is pressed the ActionSheet gets dismissed immediately.
I could add a prop that prevents the auto-dismiss to handle this use case. I'm gonna implement this ASAP.

@annisaayu
Copy link

I have this issue too in iOS. But in Android, it works

@krrevilla
Copy link

krrevilla commented Jun 13, 2021

I also experienced this issue in beefe/react-native-actionsheet. I was able to fix it by adding a small delay on the callback.

const onPress = index => {
  if (index === 1) {
    setTimeout(() => {
        ImagePicker.openCamera({
          mediaType: "photo",
          width: 300,
          height: 400,
          compressImageMaxWidth: 750,
          compressImageQuality: 0.7,
          cropping: true,
        })
    }, 500)
  }
}

@alessiocancian
Copy link
Owner

I'm not sure I understood the issue, can someone please send a video with the actual behavior?

@theart84
Copy link

I also experienced this issue in beefe/react-native-actionsheet. I was able to fix it by adding a small delay on the callback.

const onPress = index => {
  if (index === 1) {
    setTimeout(() => {
        ImagePicker.openCamera({
          mediaType: "photo",
          width: 300,
          height: 400,
          compressImageMaxWidth: 750,
          compressImageQuality: 0.7,
          cropping: true,
        })
    }, 500)
  }
}

Thanks, it helped me a lot

@VanDinh18
Copy link

I have this issue in iOS on Iphone XS. But in Android, it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants