'Shuffle button is not working in react native using track-player

I am using react-native-track-player in my existing project, the issue is when user clicks on shuffle button then every time it's playing next song, I'm adding songs data like this..

addTrackForShuffle = async () => {
        await TrackPlayer.reset();
        this.state.songs?.map(async (item, index) => {
            await TrackPlayer.add({
                id: item.id,
                url: item.url,
                title: item.title,
                artist: item.artist,
                artwork: item.cover,
                album: item.release_id,
                gener: item.gener
            }).then((pp) => {
            }).catch((errpp) => {
                console.log(errpp + "....eee")
            })
        })
    }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source