Closed williambuchanan2 closed 1 year ago
Hi
I'm not using Rg.Plugins.Popup, but the problematic call is happening from a view that I am displaying as a bottom sheet. I had already tried following the code from the FAQ, but it doesn't compile. I removed the lines which were causing an issue.
Any suggestions?
but the problematic call is happening from a view that I am displaying as a bottom sheet
What is a bottom sheet?
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
Are you using MAUI or Xamarin.Forms?
Here is the link to BottomSheet:
https://github.com/VladislavAntonyuk/MauiSamples/tree/main/BottomSheet
I am using Maui.
I haven't developed MAUI apps with such perversions yet. But the logic is similar to the one used in Xamarin.Forms.
You need to create your own function that returns TopViewController
. Microsoft.Maui.ApplicationModel.Platform.GetCurrentUIViewController() is default for MAUI
.
Sample implementation for Xamarin.Forms with Rg.Plugins.Popup:
static UIViewController? GetTopViewController()
{
if (!(PopupNavigation.Instance?.PopupStack?.Any() ?? false))
return Xamarin.Essentials.Platform.GetCurrentUIViewController();
return CustomNavigationRenderer.LastController?.ViewControllers?.LastOrDefault();
}
In Xamarin.Forms, we replaced TopViewController
with the last open page:
public class RootNavigationPageRenderer : NavigationRenderer
{
public static RootNavigationPageRenderer LastNavigationController { get; private set; }
public override void ViewDidLoad()
{
base.ViewDidLoad();
LastNavigationController = this;
}
}
This is a sore topic for MAUI and Xamarin.Forms: all native windows and alerts depend on parent from which they were launched, but unfortunately access to controllers is very confusing. Microsoft.Maui.ApplicationModel
and Xamarin.Essentials
partially solve this problem. But they will never work fine with third-party libraries (BottomSheet or Rg.Plugins.Popup). Maybe there are workaround for MAUI somewhere, but you can definitely write it yourself.
Ok, thanks. I went with something like the second option just for now to get me going and it seems to work now.
So, a few days in the hole, and i'm now back to the original problem of photos coming out sideways and upside down...
of photos coming out sideways and upside down...
If the plugin rotates the image, it should change its metadata. After that, the image will no longer be original.
Several people promised to make PR with such functionality. They were all lost, I think they realized that the task is very specific to each application
it looks like I need to make a gist with a very simple code on how to rotate a image. And add a link to it in README
That would be great. I’ve tried to read the various comments about it but couldn’t find an example that concisely dealt with the problem for all platforms.
Description
When I call await MediaGallery.CapturePhotoAsync() nothing happens.
A bit more strange than that though - I have a common class which calls MediaGallery. Calling it from one page works fine (so I know the code works). But calling it from a different page doesn't.
The method I call is below. It gets as far as await MediaGallery.CapturePhotoAsync(). I see nothing happening when I execute this line. I can't see any exceptions or anything - the call just never returns.
Actual Behavior
Nothing happens
Expected behavior
Camera should open
Steps to reproduce the behavior
Screenshots or Videos
Reproduction Link
Configuration