2

After using VNDocumentCameraViewController in Compose Multiplatform iOS, all popup-based components (AlertDialog, DatePickerDialog, ExposedDropdownMenuBox) stop working.

  1. Open AlertDialog - works fine
  2. Open VNDocumentCameraViewController scanner
  3. Close scanner
  4. Try to open AlertDialog again - doesn't show

This is my code:

@Composable actual fun rememberDocumentScanner( onResult: (Result<List<KmpImage>>) -> Unit, options: DocumentScannerOptions ): DocumentScanner { val localViewController = LocalUIViewController.current return object : DocumentScanner { override fun scan() { val controller = VNDocumentCameraViewController() controller.setDelegate( DocumentScannerDelegate( onError = { controller.dismissViewControllerAnimated(true) { restoreComposeWindow(localViewController) } // error handling }, onCancel = { controller.dismissViewControllerAnimated(true) { restoreComposeWindow(localViewController) } }, onResult = { result -> controller.dismissViewControllerAnimated(true) { restoreComposeWindow(localViewController) } // result handling } ) ) localViewController.presentViewController(controller, animated = true) { // scanner configuration } } } } fun restoreComposeWindow(localViewController: UIViewController?) { val view = localViewController?.view ?: return view.setNeedsLayout() view.layoutIfNeeded() view.setNeedsDisplay() } 
  • OK Scanner opens and works perfectly
  • OK Regular UI components (TextField, Button, Navigation) work fine
  • FAIL AlertDialog - doesn't show after scanner
  • FAIL DatePickerDialog - doesn't show after scanner
  • FAIL ExposedDropdownMenuBox - doesn't show after scanner
  • FAIL All popup-based components fail
1
  • If you have not done so already, consider filing a bug report with JetBrains. Commented Oct 18 at 15:02

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.