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

[Need Help] Is it possible to trigger the re-render of a Virtualized component onTransitionEnd()? #632

Open
ajaypillay opened this issue Dec 23, 2020 · 0 comments

Comments

@ajaypillay
Copy link

Hi, I'm looking for some help or guidance in how I should go about triggering a re-render of a Virtualized component onTransitionEnd() instead of onChangeIndex(). Currently I have set overscanSlideBefore and overscanSlideAfter to 1 each because there is quite an amount of DOM rendering currently being done within each swipeable view. What happens is that there are freezes (which I combat with an animated transition). Here's what it looks like with animations:

t_video6276102389564965519.mp4

And here's what it looks like without an animation:

t_video6276102389564965520.mp4

I trimmed down what's being rendered to show what's happening and you can see the very apparent jumps in the second video due to the re-rendering, which is being triggered onChangeIndex() instead of onTransitionEnd().

  <VirtualizeSwipeableViews
    enableMouseEvents
    index={this.state.swipeIndex}
    axis={"y"}
    disabled={drag}
    springConfig={{
      duration: "0.4s",
      easeFunction: "cubic-bezier(0.37, 0, 0.63, 1)",
      delay: "0.0s"}}
    onChangeIndex={(index, indexLatest, meta) => {
      this.setSwipeIndex(index);
    }}
    slideCount={this.state.data_array.length}
    overscanSlideBefore={1}
    overscanSlideAfter={1}
    slideRenderer={(params) => {
      const { index, key } = params;
      return(<DataComponent key={key} />);
    }}
/>

Is there any way to force slideRenderer to render the next/prev slide only AFTER the transition has ended, so these freezes don't occur?

@ajaypillay ajaypillay changed the title Is it possible to trigger the re-render of a Virtualized component onTransitionEnd()? [Need Help] Is it possible to trigger the re-render of a Virtualized component onTransitionEnd()? Dec 23, 2020
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

1 participant