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

feat(carousel-native): association #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Andries-Smit
Copy link
Contributor

The carousel widget is limited to static use cases. On the initial render, the first item is always shown. When the user changes an active item in the carousel, there is no way that the context can be aware of the active item. There is no way to change the active item in the carousel by any logic.

Use cases:

  • Open an item in the middle of the carousel.
  • Have a button outside of the carousel that applies to the contents of the carousel.
  • Have buttons control the current state of the carousel.
  • Fire an event (for example, nanoflow) when the carousel active item changes.

Solution: carousel as reference selector:

  • Add an association of the carousel's context to the carousel's content item. This function is similar to the reference selector, except the carousel always selects one item.
  • Add an "On change" event on the association.
  • Have a way to control if the active items change with/without animation. (No animation, allowing the carousel to change before an overlaying page is closed.)
    See the animation below...

This requires some defined states of what happens when:

Action Reference select Carousel Carousel with association
First render, No association set no selection Show first index Set first as reference
Empty data source, add data no selection Show first index Set first as reference
Delete item, after current selected no change Persist selected index Persist current selection
Delete current selected Association set to empty Index persist, item after is selected Move to index 0
Delete item, before current No change Index persist, item after previous selected Persist selected, change index
All items removed No selection Carousel not visible Association set to empty
Add before current selected No change Persist selected index, change active Persist current selection, change index

NativeCarouselAssociation

@Andries-Smit Andries-Smit requested a review from a team as a code owner November 27, 2023 09:54
@Andries-Smit Andries-Smit force-pushed the feat/carousel-association branch from d60c596 to d5700b3 Compare November 29, 2023 14:24
@Andries-Smit Andries-Smit force-pushed the feat/carousel-association branch from d5700b3 to baa0fde Compare November 29, 2023 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants