Я также отображаю местоположение через сервер и полигон.
Когда пользователь выходит за пределы полигона, он выдает какое-то сообщение.
<MapView
style={styles.map}
toolbarEnabled={true}
region={{
latitude:this.state.lat,
longitude: this.state.long,
latitudeDelta: 0.015,
longitudeDelta: 0.0121,
}}
rotateEnabled={true}
provider={this.props.provider}
onPress={e => this.onPress(e)}
{...mapOptions}
animateToCoordinate={[this.state.initialPosition, 500]}
>
{this.state.polygons.map(polygon => (
<Polygon
key={polygon.id}
coordinates={polygon.coordinates}
holes={polygon.holes}
strokeColor="#F00"
fillColor="rgba(255,0,0,0.5)"
strokeWidth={2}
/>
))}
{this.state.editing && (
<Polygon
key={this.state.editing.id}
coordinates={this.state.editing.coordinates}
holes={this.state.editing.holes}
strokeColor="#000"
fillColor="rgba(255,0,0,0.5)"
strokeWidth={2}
/>
)}
<Marker coordinate={{
latitude:this.state.lat,
longitude: this.state.long}} >
</Marker>
</MapView>
Я использую:
- реактивный родной: 0.47.1
- реагирующие родные карты: 0.20.1