bramus / react-native-maps-directions

Directions Component for `react-native-maps`
MIT License
1.24k stars 196 forks source link

How do I get a linear gradient in strokeColor props #178

Open musabgulfam opened 2 years ago

musabgulfam commented 2 years ago

I am trying to create a linear gradient on the stroke of maps. Currently this is my attempt by far, which failed too.

<MapViewDirections
    mode={'DRIVING'}
    origin={coordinates[0]}
    destination={coordinates[1]}
    apikey={API_KEY}
    strokeWidth={10}
    strokeColor={_ => 
        <LinearGradient
            colors={['#8F55F7', '#587CF5']}
            style={{width: '100%', height: '100%'}}
        />
    }
    timePrecision={"now"}
    onReady={data => {
        console.log('ONREADY DATA: ', data);
        setDuration(data.duration);
        setDistance(data.distance * 0.621371);
        setCarAngle(calculateAngle(data.coordinates));
        getTripStatus(tripInfo.ID, username, password)
    }}
/>

This is the result I am looking for is Screenshot 2021-10-22 at 4 22 23 PM

Alpacora commented 2 years ago

if you manage to do this, please let me now. 🙏🏻

atdhetwig commented 1 year ago

strokeColors={['#8F55F7', '#587CF5']}