[英]can't render <MapView/> from react-native-maps
I am trying to show native map using the coords from the example and I get an error: 我试图使用示例中的坐标显示本机地图,但出现错误:
*note using ios and real device for debugging *注意使用ios和真实设备进行调试
ERROR: 错误:
Could not inset compass from edges 9
Could not inset scale from edge
Could not inset legal attribution from corner 4
CODE: 码:
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,
}}
/>
);
}}
it was a problem with styling. 这是样式的问题。 I was able to fix it with this code:
我可以用以下代码修复它:
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.