react-native-maps-directions icon indicating copy to clipboard operation
react-native-maps-directions copied to clipboard

How do I get a linear gradient in strokeColor props

Open musabgulfam opened this issue 3 years ago • 2 comments

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

musabgulfam avatar Oct 22 '21 11:10 musabgulfam

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

Alpacora avatar Jul 21 '22 23:07 Alpacora

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

atdhetwig avatar Mar 16 '23 14:03 atdhetwig