React-native-maps: Is there any option to render map with default zoom ?

Created on 26 Mar 2018  路  3Comments  路  Source: react-native-maps/react-native-maps

Is this a bug report?

No

Have you read the Installation Instructions?

Yes

Environment

react-native: 0.54.2
react: 16.0.016.3.0-alpha.1
react-native-maps: https://github.com/react-community/react-native-maps.git

Is there an option to render the map with default zoom option ? I checked props of MapView but I didn't find any about that.

question

Most helpful comment

import { Dimensions } from 'react-native';
const { height, width } = Dimensions.get( 'window' );
const LATITUDE = 40.74333; // Korea Town, New York, NY 10001
const LONGITUDE = -73.99033; // Korea Town, New York, NY 10001
const LATITUDE_DELTA = 0.28;
const LONGITUDE_DELTA = LATITUDE_DELTA * (width / height);

<MapView
    initialRegion={{
        latitude: LATITUDE,
        longitude: LONGITUDE,
        latitudeDelta: LATITUDE_DELTA,
        longitudeDelta: LONGITUDE_DELTA
    }}
    ...
>

LATITUDE_DELTA = zoom level

All 3 comments

@Anandks1993 The zoom is controlled by longitudeDelta and latituteDelta.

@rborn Thank you 馃

import { Dimensions } from 'react-native';
const { height, width } = Dimensions.get( 'window' );
const LATITUDE = 40.74333; // Korea Town, New York, NY 10001
const LONGITUDE = -73.99033; // Korea Town, New York, NY 10001
const LATITUDE_DELTA = 0.28;
const LONGITUDE_DELTA = LATITUDE_DELTA * (width / height);

<MapView
    initialRegion={{
        latitude: LATITUDE,
        longitude: LONGITUDE,
        latitudeDelta: LATITUDE_DELTA,
        longitudeDelta: LONGITUDE_DELTA
    }}
    ...
>

LATITUDE_DELTA = zoom level

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KarlosQ picture KarlosQ  路  3Comments

wpram picture wpram  路  3Comments

npomfret picture npomfret  路  3Comments

nbastoWM picture nbastoWM  路  3Comments

divye01 picture divye01  路  3Comments