Когда я поворачиваю карту и обновляю регион, она автоматически центрируется
import React, { Component } from 'react';
import {
StyleSheet,
Dimensions,
} from 'react-native';
import MapView from "react-native-maps";
const {width, height} = Dimensions.get('window');
const ASPECT_RATIO = width / height;
const LATITUDE_DELTA = 0.5;
const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO;
type Props = {};
export default class App extends Component<Props> {
onRegionChange(region) {
this.setState({ region });
}
constructor(props){
super(props);
this.coordinate = {
latitude: 35.688442,
longitude: 51.403753,
latitudeDelta: LATITUDE_DELTA,
longitudeDelta: LONGITUDE_DELTA,
};
this.state = {
region : this.coordinate
}
}
render() {
return (
<MapView
region={this.state.region}
onRegionChangeComplete={this.onRegionChange.bind(this)}
style={{...StyleSheet.absoluteFillObject}}
/>
);
}
}