【问题标题】:GoogleMaps on Ionic5 messing up Swipe ModalIoniq 5 上的谷歌地图搞砸了滑动模式
【发布时间】:2020-04-10 23:25:32
【问题描述】:

我在使用 GoogleMaps 和新的 “滑动关闭” 模式时遇到问题。 我的问题是通过 GoogleMaps 附加到 body 的类 _gmaps_cdv_ 正在将背景颜色更改为白色。效果看起来很奇怪很糟糕。

我几乎什么都试过了……

  1. 加载模式后删除类。这将使地图消失并采用我设置的任何颜色作为背景。

  2. 一旦加载了模态框,就删除该类,并在模态框被破坏后再次附加它。结果和之前一样

  3. 在 ionViewWillLeave() 上销毁地图并使用 ionViewWIllLoad() 重新创建。结果和之前一样。

有什么建议吗?这是一个错误吗?

谢谢

【问题讨论】:

    标签: ionic-framework ionic5


    【解决方案1】:

    我解决了这个问题。解决方案非常简单。背景颜色可以在GoogleMaps的Environment类中设置。

    确保 Environment 已导入到您的组件中,并执行以下操作:

    // If you're following the documentation, there should be more things imported here, because I'm focusing on the Environment, I will only use this one.
    import { Environment } from '@ionic-native/google-maps/ngx';
    
    ngOninit() {
       Environment.setBackgroundColor('black'); // Or whatever color you want.
    }
    

    就是这样! 以下是供参考的文档链接:

    https://github.com/ionic-team/ionic-native-google-maps/blob/master/documents/environment/README.md

    【讨论】:

      猜你喜欢
      • 2012-02-11
      • 2014-10-25
      • 2015-12-27
      • 2015-05-17
      • 2013-01-15
      • 1970-01-01
      • 2020-04-26
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多