【问题标题】:react-native-maps blank page in iosios中的react-native-maps空白页
【发布时间】:2016-12-22 07:40:07
【问题描述】:

我在这个问题上遇到了同样的问题: react-native - How to display map using react-native-maps

有人建议执行react-native link 来解决这个问题,但它对我不起作用。

这个问题还有其他解决方案吗?

屏幕:

import React, { Component } from 'react';
import { StyleSheet, View, Dimensions } from 'react-native';
import MapView from 'react-native-maps';

var { width, height} = Dimensions.get('window');

const styles = StyleSheet.create({
  container: { 
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    justifyContent: 'flex-end',
    alignItems: 'center',

  },
  map: {
    position: 'absolute',
    top: 0,
    left: 0,
    right: 0,
    bottom: 0,
    width: width,
    height: height
  },
});

class TestMap extends Component {

  constructor() {
    super();
  }

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

}

export default TestMap;

【问题讨论】:

    标签: ios react-native react-native-maps


    【解决方案1】:

    尝试像这样重写你的样式:

    const styles = StyleSheet.create({
      container: { 
        flex: 1,
      },
      map: {
        flex: 1,
      },
    });
    

    【讨论】:

    • 不成功。红色边框像一条垂直的红线一样向左移动
    • 包含的源码已经是全图实现
    • 一定有更多:) 否则就不会有这个红色边框
    • 我终于解决了这个问题。问题是我不知道如何将 AirMaps 和 AirGoogleMaps 目录添加到 xcode 项目中。大声笑
    • 如果您使用的是真机模拟器(如 Genymotion),请确保您已安装 Google Play 支持。检查您的设备是否启用了互联网(GPS/Wifi/数据)。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-04
    • 1970-01-01
    • 1970-01-01
    • 2020-10-11
    • 2021-09-05
    • 2021-02-10
    相关资源
    最近更新 更多