Skip to content

Navigation Dots #282

Answered by igordanchenko
YuroZen asked this question in Q&A
Jun 14, 2024 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

I'm assuming you added your module with the addModule plugin function. If that's the case, then you should also render children in your module.

Alternatively, you can use the addChild plugin function:

addChild(MODULE_CONTROLLER, createModule("dots", NavigationDotsModule));

Please feel free to use the following draft as a starting point.

function NavigationDotsModule() {
  const { slides, currentIndex } = useLightboxState();
  const dispatch = useLightboxDispatch();

  const navigateTo = (index: number) => () => {
    dispatch({ type: "swipe", increment: index - currentIndex });
  };

  return (
    <div style={{ position: "absolute", bottom: 16 }}>
      {slides.map((_, index) => (
        <

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@igordanchenko
Comment options

Answer selected by YuroZen
@YuroZen
Comment options

@igordanchenko
Comment options

@YuroZen
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants