@@ -87,7 +87,7 @@ const NavigationControls: React.FC<NavigationControlsProps> = ({
8787 // single destination:
8888 const initWaypoint = async ( ) => {
8989 if ( ! latitude . trim ( ) || ! longitude . trim ( ) ) {
90- Alert . alert ( 'Invalid destination ' ) ;
90+ Alert . alert ( 'Set lat lng values first ' ) ;
9191 return ;
9292 }
9393 const waypoint : Waypoint = {
@@ -117,19 +117,16 @@ const NavigationControls: React.FC<NavigationControlsProps> = ({
117117 ) ;
118118 } ;
119119
120- const initWaypointToCameraLocation = async ( ) => {
120+ const setLocationFromCameraLocation = async ( ) => {
121121 if ( getCameraPosition ) {
122122 const cameraPosition = await getCameraPosition ( ) ;
123123 if ( cameraPosition ) {
124124 onLatChanged ( cameraPosition . target . lat . toString ( ) ) ;
125125 onLngChanged ( cameraPosition . target . lng . toString ( ) ) ;
126126 }
127- await initWaypoint ( ) ;
128127 }
129128 } ;
130129
131- // multi destination:
132- // set your device (emulator) location to new new york timesquare
133130 const initWaypoints = async ( ) => {
134131 const wp1 = {
135132 placeId : 'ChIJw____96GhYARCVVwg5cT7c0' , // Golden gate, SF
@@ -199,7 +196,7 @@ const NavigationControls: React.FC<NavigationControlsProps> = ({
199196
200197 const simulateLocation = ( ) => {
201198 if ( ! latitude . trim ( ) || ! longitude . trim ( ) ) {
202- Alert . alert ( 'Invalid destination ' ) ;
199+ Alert . alert ( 'Set lat lng values first ' ) ;
203200 return ;
204201 }
205202
@@ -330,6 +327,7 @@ const NavigationControls: React.FC<NavigationControlsProps> = ({
330327
331328 return (
332329 < View >
330+ < Text > Target</ Text >
333331 < TextInput
334332 style = { styles . input }
335333 onChangeText = { onLatChanged }
@@ -346,13 +344,18 @@ const NavigationControls: React.FC<NavigationControlsProps> = ({
346344 placeholderTextColor = "#000"
347345 keyboardType = "numeric"
348346 />
349- < Button title = "Dispose navigation" onPress = { disposeNavigation } />
350- < Button title = "Single Destination" onPress = { initWaypoint } />
351- < Button title = "Multiple Destination" onPress = { initWaypoints } />
352347 < Button
353- title = "Set destination from Camera Location"
354- onPress = { initWaypointToCameraLocation }
348+ title = "Set target from Camera Location"
349+ onPress = { setLocationFromCameraLocation }
350+ />
351+ < Button
352+ title = "Simulate location from target"
353+ onPress = { simulateLocation }
355354 />
355+ < Button title = "Set target as Destination" onPress = { initWaypoint } />
356+ < View style = { styles . controlButtonGap } />
357+ < Button title = "Multiple Destination" onPress = { initWaypoints } />
358+ < Button title = "Dispose navigation" onPress = { disposeNavigation } />
356359 < Button
357360 title = "Continue to next destination"
358361 onPress = { continueToNextDestination }
@@ -362,7 +365,6 @@ const NavigationControls: React.FC<NavigationControlsProps> = ({
362365 < Button title = "Stop guidance" onPress = { stopGuidance } />
363366 < Button title = "Start updating location" onPress = { startUpdatingLocation } />
364367 < Button title = "Stop updating location" onPress = { stopUpdatingLocation } />
365- < Button title = "Simulate location" onPress = { simulateLocation } />
366368 < Button title = "Start simulation" onPress = { startSimulation } />
367369 < Button title = "Stop simulation" onPress = { stopSimulation } />
368370 < Button title = "Pause simulation" onPress = { pauseSimulation } />
0 commit comments