bramus / react-native-maps-directions

Directions Component for `react-native-maps`
MIT License
1.25k stars 198 forks source link

Pass data from onReady event... #172

Closed esadkrs closed 3 years ago

esadkrs commented 3 years ago

Hi,

Can anyone please help on how I can pass data from onReady event to a <Text> widget on the Marker/Callout? I wanna be able to display the distance on the text basically.

See below for the detailed question.

Example Question

dhumal436 commented 3 years ago

Hi,

Can anyone please help on how I can pass data from onReady event to a <Text> widget on the Marker/Callout? I wanna be able to display the distance on the text basically.

See below for the detailed question.

Example Question

   ```

<MapViewDirections origin={userLocation} destination={selectedDirection} strokeColor={'#0076BC'} apikey={'XXXXXXXXXXX'} strokeWidth={5} onReady={setDirectionData} />


Like in the above example you can pass a callback function and set data into the state and use
`<Text>{directionData.distance}</Text>`