无法从 react-native-maps 渲染 <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,
}}
/>
);
}}
项目示例:HERE
样式有问题。我能够使用以下代码修复它:
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,
},
});
我正在尝试使用示例中的坐标显示原生地图,但出现错误:
*注 使用 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,
}}
/>
);
}}
项目示例:HERE
样式有问题。我能够使用以下代码修复它:
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,
},
});