@@ -129,93 +129,113 @@ const MapsControls = ({
129129 } ;
130130
131131 const getMyLocation = async ( ) => {
132- const result = await mapViewController . getMyLocation ( ) ;
133- log ( `My location: ${ JSON . stringify ( result ) } ` ) ;
132+ try {
133+ const result = await mapViewController . getMyLocation ( ) ;
134+ log ( `My location: ${ JSON . stringify ( result ) } ` ) ;
135+ } catch ( error ) {
136+ log ( `Error getting location: ${ error } ` ) ;
137+ }
134138 } ;
135139
136140 const addMarker = async ( imgPath ?: string ) => {
137- const cameraPosition = await mapViewController . getCameraPosition ( ) ;
138-
139- const marker : Marker = await mapViewController . addMarker ( {
140- position : cameraPosition . target ,
141- visible : true ,
142- title : 'Marker test' ,
143- snippet : 'Marker test' ,
144- alpha : 0.8 ,
145- rotation : 0 ,
146- flat : false ,
147- draggable : true ,
148- imgPath : imgPath ,
149- } ) ;
141+ try {
142+ const cameraPosition = await mapViewController . getCameraPosition ( ) ;
143+
144+ const marker : Marker = await mapViewController . addMarker ( {
145+ position : cameraPosition . target ,
146+ visible : true ,
147+ title : 'Marker test' ,
148+ snippet : 'Marker test' ,
149+ alpha : 0.8 ,
150+ rotation : 0 ,
151+ flat : false ,
152+ draggable : true ,
153+ imgPath : imgPath ,
154+ } ) ;
150155
151- log ( `Added marker: ${ marker . id } ` ) ;
156+ log ( `Added marker: ${ marker . id } ` ) ;
157+ } catch ( error ) {
158+ log ( `Error adding marker: ${ error } ` ) ;
159+ }
152160 } ;
153161
154162 const addCustomMarker = async ( ) => {
155163 addMarker ( 'circle.png' ) ;
156164 } ;
157165
158166 const addCircle = async ( ) => {
159- const cameraPosition = await mapViewController . getCameraPosition ( ) ;
160-
161- const circle : Circle = await mapViewController . addCircle ( {
162- center : cameraPosition . target ,
163- radius : 100 ,
164- fillColor : '#FFFFFF' ,
165- strokeColor : '#000000' ,
166- strokeWidth : 5 ,
167- visible : true ,
168- clickable : true ,
169- } ) ;
167+ try {
168+ const cameraPosition = await mapViewController . getCameraPosition ( ) ;
169+
170+ const circle : Circle = await mapViewController . addCircle ( {
171+ center : cameraPosition . target ,
172+ radius : 100 ,
173+ fillColor : '#FFFFFF' ,
174+ strokeColor : '#000000' ,
175+ strokeWidth : 5 ,
176+ visible : true ,
177+ clickable : true ,
178+ } ) ;
170179
171- log ( `Added circle: ${ circle . id } ` ) ;
180+ log ( `Added circle: ${ circle . id } ` ) ;
181+ } catch ( error ) {
182+ log ( `Error adding circle: ${ error } ` ) ;
183+ }
172184 } ;
173185
174186 const addPolyline = async ( ) => {
175- const cameraPosition = await mapViewController . getCameraPosition ( ) ;
176-
177- const latLngs = [ ] ;
178-
179- for ( let idx = 0 ; idx < 100 ; idx ++ ) {
180- latLngs . push ( {
181- lat : cameraPosition . target . lat + idx / 10000 ,
182- lng : cameraPosition . target . lng + idx / 10000 ,
187+ try {
188+ const cameraPosition = await mapViewController . getCameraPosition ( ) ;
189+
190+ const latLngs = [ ] ;
191+
192+ for ( let idx = 0 ; idx < 100 ; idx ++ ) {
193+ latLngs . push ( {
194+ lat : cameraPosition . target . lat + idx / 10000 ,
195+ lng : cameraPosition . target . lng + idx / 10000 ,
196+ } ) ;
197+ }
198+
199+ const polyline : Polyline = await mapViewController . addPolyline ( {
200+ points : latLngs ,
201+ width : 10 ,
202+ color : '#f52525' ,
203+ visible : true ,
204+ clickable : true ,
183205 } ) ;
184- }
185-
186- const polyline : Polyline = await mapViewController . addPolyline ( {
187- points : latLngs ,
188- width : 10 ,
189- color : '#f52525' ,
190- visible : true ,
191- clickable : true ,
192- } ) ;
193206
194- log ( `Added polyline: ${ polyline . id } ` ) ;
207+ log ( `Added polyline: ${ polyline . id } ` ) ;
208+ } catch ( error ) {
209+ log ( `Error adding polyline: ${ error } ` ) ;
210+ }
195211 } ;
196212
197213 const addPolygon = async ( ) => {
198- const cameraPosition = await mapViewController . getCameraPosition ( ) ;
199- const cameraLat = cameraPosition . target . lat ;
200- const cameraLng = cameraPosition . target . lng ;
201- const delta = 0.05 ;
202- const bermudaTriangle = [
203- { lat : cameraLat - delta , lng : cameraLng - delta } ,
204- { lat : cameraLat - delta , lng : cameraLng + delta } ,
205- { lat : cameraLat + delta , lng : cameraLng + delta } ,
206- { lat : cameraLat - delta , lng : cameraLng - delta } ,
207- ] ;
208-
209- const polygon : Polygon = await mapViewController . addPolygon ( {
210- strokeColor : '#FF00FF' ,
211- fillColor : '#f52525' ,
212- strokeWidth : 10 ,
213- visible : true ,
214- points : bermudaTriangle ,
215- clickable : true ,
216- } ) ;
214+ try {
215+ const cameraPosition = await mapViewController . getCameraPosition ( ) ;
216+ const cameraLat = cameraPosition . target . lat ;
217+ const cameraLng = cameraPosition . target . lng ;
218+ const delta = 0.05 ;
219+ const bermudaTriangle = [
220+ { lat : cameraLat - delta , lng : cameraLng - delta } ,
221+ { lat : cameraLat - delta , lng : cameraLng + delta } ,
222+ { lat : cameraLat + delta , lng : cameraLng + delta } ,
223+ { lat : cameraLat - delta , lng : cameraLng - delta } ,
224+ ] ;
225+
226+ const polygon : Polygon = await mapViewController . addPolygon ( {
227+ strokeColor : '#FF00FF' ,
228+ fillColor : '#f52525' ,
229+ strokeWidth : 10 ,
230+ visible : true ,
231+ points : bermudaTriangle ,
232+ clickable : true ,
233+ } ) ;
217234
218- log ( `Added polygon: ${ polygon . id } ` ) ;
235+ log ( `Added polygon: ${ polygon . id } ` ) ;
236+ } catch ( error ) {
237+ log ( `Error adding polygon: ${ error } ` ) ;
238+ }
219239 } ;
220240
221241 const clearMapView = ( ) => {
@@ -303,7 +323,7 @@ const MapsControls = ({
303323 { /* Map Appearance */ }
304324 < Accordion title = "Map Appearance" >
305325 < View style = { ControlStyles . rowContainer } >
306- < Text > Map type</ Text >
326+ < Text style = { ControlStyles . rowLabel } > Map type</ Text >
307327 < SelectDropdown
308328 data = { mapTypeOptions }
309329 onSelect = { ( _selectedItem , index ) => {
@@ -334,7 +354,7 @@ const MapsControls = ({
334354 />
335355 </ View >
336356 < View style = { ControlStyles . rowContainer } >
337- < Text > Map color scheme</ Text >
357+ < Text style = { ControlStyles . rowLabel } > Map color scheme</ Text >
338358 < SelectDropdown
339359 data = { colorSchemeOptions }
340360 defaultValueByIndex = { colorSchemeIndex }
@@ -366,7 +386,7 @@ const MapsControls = ({
366386 />
367387 </ View >
368388 < View style = { ControlStyles . rowContainer } >
369- < Text > Custom map paddings</ Text >
389+ < Text style = { ControlStyles . rowLabel } > Custom map paddings</ Text >
370390 < ExampleAppButton
371391 title = { customPaddingEnabled ? 'Disable' : 'Enable' }
372392 onPress = { toggleCustomPadding }
@@ -377,7 +397,7 @@ const MapsControls = ({
377397 { /* Location & UI */ }
378398 < Accordion title = "Location & UI Settings" >
379399 < View style = { ControlStyles . rowContainer } >
380- < Text > Location marker</ Text >
400+ < Text style = { ControlStyles . rowLabel } > Location marker</ Text >
381401 < ExampleAppButton
382402 title = { enableLocationMarker ? 'Disable' : 'Enable' }
383403 onPress = { ( ) => {
0 commit comments