LonelyCpp / react-native-youtube-iframe

A wrapper of the Youtube-iframe API built for react native.
https://lonelycpp.github.io/react-native-youtube-iframe/
MIT License
594 stars 147 forks source link

onChangeState with Flatlist is not working #334

Open vishaledkey opened 3 months ago

vishaledkey commented 3 months ago

Hi, I'm using the YouTubePlayer inside a FlatList. I want to use the onChangeState and onReady functions, but these functions don't seem to be working. When I try to use YouTubePlayer outside the FlatList (standalone instance), it works fine and both the mentioned functions work fine.

code:

const renderListItem = ({ item, index }) => {
        return (
            <View key={item.videoId}>
                <View style={styles.listItemContainer} >
                    <View>

                             <YoutubePlayer
                                height={240}
                                play={false}
                                videoId={item.videoId}
                                onReady={() => {console.log("Vishal:: youtube ready")}}
                                onChangeState={(event) => {console.log("Vishal:: youtube event", event)}}
                            />
                        <Text style={styles.itemDuration} numberOfLines={1}> {item.lengthText}</Text>
                    </View>
                    //rest of the code
                </View>
            </View>
        );
    };

Library version: "react-native-youtube-iframe": "^2.3.0"

Roamer77 commented 2 months ago

same

sraut1 commented 2 months ago

Same issue, were you able to find any solution to it?