简体   繁体   English

react-native-hms-maps map 为空白

[英]react-native-hms-maps map is blank

I have a react native app that I am currently trying to make compliant with Huawei's HMS APK so that users with Mate 30 or P40 devices can use our app.我有一个 React Native 应用程序,我目前正在尝试使其与华为的 HMS APK 兼容,以便拥有 Mate 30 或 P40 设备的用户可以使用我们的应用程序。

I have removed react-native-maps for this release and I have replaced it with react-native-hms-maps by following the instructions found in the Huawei HMS Core Developer Guides for React-Native.我已删除此版本的 react-native-maps,并按照 React-Native 的华为 HMS Core 开发人员指南中的说明将其替换为 react-native-hms-maps。

When I run the app, and I navigate to the screen where I am rendering the map, only a blank page shows.当我运行该应用程序并导航到我正在呈现 map 的屏幕时,只显示一个空白页面。 Upon running the app with the logcats running, I was able to pin point this error in the logs:在运行 logcats 的情况下运行应用程序后,我能够在日志中指出此错误:

2020-09-01 23:23:27 23608-23608/? I/MapRender: ERROR MapView.cpp:296: MapView::[SwitchMapType] enter!

I don't know if this is related to my problem.我不知道这是否与我的问题有关。

My react-native code looks like this:我的 react-native 代码如下所示:

import HMSMap from 'react-native-hms-map';

...other code....

render = () => {
  const address = this.state.address;

  return (
   <View style={styles.container}>
    <HMSMap
      style={styles.map}
      initialRegion={{
        latitude: 37.78825,
        longitude:  -122.4324,
        latitudeDelta:  0.0922,
        longitudeDelta:  0.0421,
      }}
    />
   </View>
  );
 };

And my style object looks like this:而我的风格 object 看起来像这样:

 container: {
  ...StyleSheet.absoluteFillObject,
  justifyContent: 'flex-end',
  alignItems: 'center',
  borderColor: 'black',
  borderWidth: 2
 },
 map: {
  ...StyleSheet.absoluteFillObject
 }

Any idea what I could be doing wrong?知道我可能做错了什么吗?

You are using the old version of React Native Map Plugin 4.0.2, and it will be placed offline after July 30, 2020, which causes this issue.您使用的是旧版本的React Native Map Plugin 4.0.2,2020年7月30日后将被下线,导致出现该问题。

A note is added on “ Version Change History ” part on documentation, please kindly refer to it.在文档的“ 版本变更历史”部分添加了注释,请参阅。

You can refer the article HMS Map Kit Elucidated: Using React Native to know about how to integrate HMS Map in React Native.可以参考文章HMS Map Kit Elucidated: Using React Native了解如何在React Native中集成HMS Map。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM