(props: any)
| 12 | const LONGITUDE_DELTA = LATITUDE_DELTA * ASPECT_RATIO; |
| 13 | |
| 14 | const MapBoundaries = (props: any) => { |
| 15 | const [region] = useState({ |
| 16 | latitude: LATITUDE, |
| 17 | longitude: LONGITUDE, |
| 18 | latitudeDelta: LATITUDE_DELTA, |
| 19 | longitudeDelta: LONGITUDE_DELTA, |
| 20 | }); |
| 21 | |
| 22 | const [mapBoundaries, setMapBoundaries] = useState<BoundingBox | null>(null); |
| 23 | const mapRef = useRef<MapView>(null); |
| 24 | |
| 25 | const onRegionChangeComplete = () => { |
| 26 | if (mapRef.current) { |
| 27 | mapRef.current.getMapBoundaries().then(boundaries => { |
| 28 | setMapBoundaries(boundaries); |
| 29 | }); |
| 30 | } |
| 31 | }; |
| 32 | |
| 33 | return ( |
| 34 | <View style={styles.container}> |
| 35 | <MapView |
| 36 | ref={mapRef} |
| 37 | provider={props.provider} |
| 38 | style={styles.map} |
| 39 | initialRegion={region} |
| 40 | onMapReady={onRegionChangeComplete} |
| 41 | onRegionChangeComplete={onRegionChangeComplete} |
| 42 | /> |
| 43 | <View style={styles.buttonContainer}> |
| 44 | <View style={styles.bubble}> |
| 45 | <Text>{JSON.stringify(mapBoundaries)}</Text> |
| 46 | </View> |
| 47 | </View> |
| 48 | </View> |
| 49 | ); |
| 50 | }; |
| 51 | |
| 52 | const styles = StyleSheet.create({ |
| 53 | container: { |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…