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

[React][Question] New children don't get updated by infinite viewer when scrolling #69

Open
mendesnathanj opened this issue Nov 20, 2023 · 0 comments

Comments

@mendesnathanj
Copy link

mendesnathanj commented Nov 20, 2023

I couldn't find any open issues or examples of this, but when i render elements under the InfiniteViewer component and they are added after the infinite viewer is initially rendered, then they aren't being updated via the translate effect that infinite viewer does.

Is there something on my end I'm missing or is it not something the library supports for now?

Items that exist initially render completely fine and don't have any issues

A simplified example would look like this

function App() {
  // items are initially empty
  const [items, setItems] = useState([]);

  // add a new item once a second
  useEffect(() => {
    setTimeout(() => {
       setItems((prev) => ([...prev, <div style={{ left: 50, top: 50 }} />]));
    }, 1000);
  }, []);
  
  return <InfiniteViewer>{items}</InfiniteViewer>;
}
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