File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,12 @@ storiesOf('MapView', module)
27
27
. add ( 'options' , ( ) => (
28
28
< View style = { styles . container } >
29
29
< MapView
30
- initialRegion = { { latitude : 48.86 , longitude : 2.34 } }
30
+ initialRegion = { {
31
+ latitude : 48.86 ,
32
+ longitude : 2.34 ,
33
+ latitudeDelta : 0.1 ,
34
+ longitudeDelta : 0.1 ,
35
+ } }
31
36
options = { {
32
37
zoomControlOptions : {
33
38
position : window . google . maps . ControlPosition . RIGHT_CENTER ,
Original file line number Diff line number Diff line change @@ -54,7 +54,12 @@ class MapView extends Component {
54
54
lng : initialRegion . longitude ,
55
55
} ,
56
56
} ;
57
-
57
+ const zoom =
58
+ region && region . latitudeDelta
59
+ ? Math . round ( Math . log ( 360 / region . latitudeDelta ) / Math . LN2 )
60
+ : initialRegion && initialRegion . latitudeDelta
61
+ ? Math . round ( Math . log ( 360 / initialRegion . latitudeDelta ) / Math . LN2 )
62
+ : 15 ;
58
63
return (
59
64
< View style = { style } >
60
65
< GoogleMapContainer
@@ -64,7 +69,7 @@ class MapView extends Component {
64
69
{ ...centerProps }
65
70
onDragStart = { onRegionChange }
66
71
onIdle = { this . onDragEnd }
67
- defaultZoom = { 15 }
72
+ defaultZoom = { zoom }
68
73
onClick = { onPress }
69
74
options = { options } >
70
75
{ this . props . children }
You can’t perform that action at this time.
0 commit comments