繁体   English   中英

无法呈现 <MapView/> 从反应本机地图

[英]can't render <MapView/> from react-native-maps

我试图使用示例中的坐标显示本机地图,但出现错误:

*注意使用ios和真实设备进行调试

错误:

Could not inset compass from edges 9
Could not inset scale from edge 
Could not inset legal attribution from corner 4

码:

class Map extends Component {
constructor(props) {
    super(props);
}
render() {   
    console.log('map render')    
    return (
            <MapView 
            provider={null}
            initialRegion={{
            latitude: 37.78825,
            longitude: -122.4324,
            latitudeDelta: 0.0922,
            longitudeDelta: 0.0421,
            }}
        />
    );
}}

项目示例: 此处

这是样式的问题。 我可以用以下代码修复它:

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

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,
  },
});

暂无
暂无

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

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