Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The focused row index is different from onVisibleIndicesChanged #757

Open
drinikol opened this issue Feb 16, 2023 · 2 comments
Open

The focused row index is different from onVisibleIndicesChanged #757

drinikol opened this issue Feb 16, 2023 · 2 comments

Comments

@drinikol
Copy link

drinikol commented Feb 16, 2023

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}
        />
@quyentho
Copy link

I'm facing the same problem. Have you found the solution @drinikol?

@MTPL0005-AbhishekDube
Copy link

any solution you found for this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants