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

No event generated on iOS when dismissing selection dialog #138

Open
derynia opened this issue Oct 7, 2024 · 2 comments
Open

No event generated on iOS when dismissing selection dialog #138

derynia opened this issue Oct 7, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@derynia
Copy link

derynia commented Oct 7, 2024

I opened this issue before and it seemed to be resolved, but one problem is still exists

I use this code to open dialog:
val launcher = rememberFilePickerLauncher(
type =
when (type) {
SELECT_FILE_CLICKED -> PickerType.Image
SELECT_VIDEO -> PickerType.Video
else -> PickerType.File(listOf("pdf"))
},
mode = PickerMode.Single,
title = Strings.getString("pic_a_file")
) { file ->
Napier.i(tag = "Dismiss", message = "file $file")
afterPick(file)
}
launcher.launch()

All works fine but when I dismiss dialog by swipe before it fully opened (and it's animated moving from bottom to top) there's no event generated and I don't know the dialog was dismissed.
And is also occurs now in DocumentPickerDelegate. Maybe it was there in previous version I can't be sure.
I also asked this question on apple developers form and waiting for response.
I think maybe it'll be good to put a delay between call the dialog and check if it will show say in 1-2 seconds. If not maybe consider that user dismissed it before it was fully drawn.

@vinceglb
Copy link
Owner

Hi @derynia! Thanks for reporting this issue. I reproduce your problem.

I didn't update the code of DocumentPickerDelegate, so the bug was there for both since the beginning.

I'll see how to fix it.

@vinceglb vinceglb added the bug Something isn't working label Oct 18, 2024
@derynia
Copy link
Author

derynia commented Oct 18, 2024

I didn't update the code of DocumentPickerDelegate, so the bug was there for both since the beginning.

The problem exists on both pickers.
But it appears only when you quickly dismiss the bottom sheet before it's fully drawn.
I think it's apple issue.
"Cancel" button or swiping down when the bottom sheet is fully drawn works fine on both types of dialogs.
Maybe you consider using modal dialog.
I'll tried to do it this way

      val controller = PHPickerViewController(configuration = configuration)
       controller.delegate = phPickerDelegate
       controller.presentationController?.delegate = phPickerDismissDelegate
       controller.modalPresentationStyle = 0

But modalPresentationStyle = 0. This way it shows it show not a bottom sheet but a whole new window. But it did't returned from the dialog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants