amay077 / Xamarin.Forms.GoogleMaps

Map library for Xamarin.Forms using Google maps API
https://www.nuget.org/packages/Xamarin.Forms.GoogleMaps/
MIT License
546 stars 346 forks source link

Map Pin info window text not visible under iOS in dark mode. #660

Closed mikebikerider closed 4 years ago

mikebikerider commented 4 years ago

VERSIONS

PLATFORMS

ACTUAL BEHAVIOR

An app built with iOS SDK version 13.0 running on a device with iOS version 13.1.2 in dark mode shows blank Info Window opened when a map pin is selected. If the device is switched to the light mode the Info Window shows text in black, as expected. The size of the Info Window does not change. Looks like the Info Window text color in dark mode is white, not visible on the white Info Window background. The work around I implement for now is enforcing the light mode for the content page. Not a pretty workaround.

ACTUAL SCREENSHOTS/STACKTRACE

IMG_0378 Dark mode. Note the search bar above the map is rendered for the dark mode. In dark mode the search bar text color automatically switches to white and background color to black if respective properties not specified in XAML or in code. For Info Window there is no text color property I am aware of, and the background color of the info window is not affected by the dark mode. I'd expect the Info Window text color remain black in dark mode.

// paste stacktrace

EXPECTED BEHAVIOR

IMG_0377 Light mode. The search bar above the map is rendered in light mode (automatically).

HOW TO REPRODUCE

  1. Pick an existing project for an app with a pin that can be selected to show an Info Window with text. 2 Load the project into the latest version of VS 2019 (16.3.2) and rebuild the project with iOS SDK version 13.0
  2. Run the app on a iPhone or iPad with iOS version 13.x.x, or in a iOS simulator for iOS version 13.0.
  3. Switch the device or a simulator to the dark mode.
// code for reproduce
alex-munteanu commented 4 years ago

As a workaround, until a proper fix is implemented, you can create a custom renderer for the map and put this code in the OnElementChanged override:

protected override void OnElementChanged(ElementChangedEventArgs<View> e)
{
    base.OnElementChanged(e);

    if (UIDevice.CurrentDevice.CheckSystemVersion(13, 0))
    {
        this.OverrideUserInterfaceStyle = UIUserInterfaceStyle.Light;
    }
}
mikebikerider commented 4 years ago

Thank you Alexandru. I put your suggestion into my code, works like a charm. I am closing this issue