plugins icon indicating copy to clipboard operation
plugins copied to clipboard

[@nativescript/camera] IOS Camera stays behind page content if opened in nested page-router-outlet

Open wontroba666 opened this issue 4 years ago • 2 comments
trafficstars

let me paste the bug from the previous version unfortunately still not fixed, hence the request for help

https://github.com/NativeScript/nativescript-camera/issues/234

" I have a nested page-router-outlet configuration in my app. Root component template has a page-router-outlet. Child page has the following template:

<grid-layout rows="*, auto"> <page-router-outlet row="0"></page-router-outlet> <stack-layout row="1" style="height:50;background-color:red;"></stack-layout> </grid-layout>

I load a child page inside the page-router-outlet shown inside the template above. If I open the camera inside that child component, stack-layout component in the template above stays above the camera and blocks the camera buttons.

If I use a router-outlet inside the template above, I still have the same problem. " is there any chance to fix this or adjust the patch?

iOS 7.1.0, device

is there any chance to fix this or adjust the patch?

wontroba666 avatar Feb 02 '21 16:02 wontroba666

I've found adjusting the modalPresentaitonStyle fixed the issue for me locally:

imagePickerController.modalPresentationStyle = UIModalPresentationStyle.CurrentContext;

to:

imagePickerController.modalPresentationStyle = UIModalPresentationStyle.FullScreen;

Which in the node_module looks something like:

imagePickerController.modalPresentationStyle = 3 /* CurrentContext */;

to:

imagePickerController.modalPresentationStyle = 0 /* FullScreen */;

I've also tried UIModalPresentationStyle.Automatic which is -2 which also works but came in to iOS at version 13.0 so might require a runtime version check to avoid degrading older iOS versions.

I'm showing a camera in two places:

  • The first is in a List View in a nested page-router-outlet.
  • The second is in a Modal View over another page.

I tested using:

@nativescript/[email protected]
node 15.14.0
iOS 14.6

I'd checked elsewhere on the web for similar issues and one mentioned that the iOS restriction came in somewhere around iOS 13.

Only thing I've not been able to check so far is what happens on an iPad, as my guess is this may change functionality.

jamescodesthings avatar May 25 '21 13:05 jamescodesthings

Have pushed a temporary package to @codesthings/camera with the change discussed above. While awaiting discussion/feedback on https://github.com/NativeScript/plugins/pull/134

Worth testing if anyone else gets the time.

To install without having to change the name I use:

npm i -S -E @codesthings/camera @nativescript/camera@npm:@codesthings/camera

jamescodesthings avatar May 25 '21 14:05 jamescodesthings