我正在尝试使用示例中的coords显示原生地图,但我收到错误:
*注 使用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,
}}
/>
);
}}
项目示例:HERE
答案 0 :(得分:0)
这是造型的问题。我能用这段代码修复它:
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,
},
});