The focused row index is different from onVisibleIndicesChanged
drinikol opened this issue · 2 comments
drinikol commented
We are trying to implement a single screen item / full screen video similar to Tiktok.
But the problem is other Row Index plays the video not the existing one shown / focused in the screen
It usually skips the odd numbered indexes.
const layoutProvider = useRef(new LayoutProvider(
(index) => {
return 0;
},
(type, dim) => {
dim.width = Dimensions.get("window").width;
dim.height = Dimensions.get('window').height - 50;
},
));
const _onViewableItemsChanged = useRef((all, now, notNow) => {
console.log('_onVisibleIndicesChanged ', all, now, notNow)
});
const SuggestedVideoItem = useCallback((item, index) => {
return (
<View style={styles.suggestedVideoContainer}>
<YzLiveVideo
data={item}
ref={videoRef[item.yzliveId]}
pause={index !== 0}
/>
</View>
<RecyclerListView
ref={listView}
snapToAlignment={"center"}
snapToInterval={Dimensions.get("window").height - 50}
forceNonDeterministicRendering={true}
// renderFooter={() => <RenderFooter loading={isLoadingMore} />}
onEndReached={async () => await nextPage()}
onEndReachedThreshold={(Dimensions.get("window").height - 50) * 3}
// externalScrollView={ExternalScrollView}
layoutProvider={layoutProvider.current}
dataProvider={dataProvider}
rowRenderer={(type, data, index) => SuggestedVideoItem(data, index)}
onVisibleIndicesChanged={_onViewableItemsChanged.current}
/>
MTPL0005-AbhishekDube commented
any solution you found for this ?