Skip to content

Conversation

AdityaPahilwani
Copy link

Is it a bugfix ?

  • No

Is it a new feature ?

  • Add support for showing adjacent views in horizontal view
  • Added 3 new props showAdjacentViews, adjacentViewsWidth, adjacentViewsPadding.
Prop Default Type Description
showAdjacentViews false bool If true it will display adjacent views
adjacentViewsWidth 8 number Indicates how much width should be displayed of adjacent view, If showAdjacentViews is false it will be ignored.
adjacentViewsPadding 4 number Indicates the gap between adjacent views, If showAdjacentViews is false it will be ignored.
decelerationRate 'normal' enum('fast', 'normal'), number A floating-point number that determines how quickly the scroll view decelerates after the user lifts their finger.

Describe what you've done:

  • Width/height of item-Container and lazy-Item-Container will be calculated in the context of showAdjacentViews, adjacentViewsWidth, adjacentViewsPadding.
  • Instead of duplicating only 1 element in start and end, now it duplicated 2 elements. So autoplay feature can work with 0 readjusts.
  • Duplicate elements, first real element, and last real element will always be visible so when autoplay is on, the user won't see blank spots.
  • Unless and until the user swipes hard to scroll to the last duplicate element at start or end, only then they will see a little readjust after scroll but the index position will always be remembered.
  • Using snapToOffsets to get the proper swipe feature to display our adjacentViews.

How to test it ?

Have added examples for the same, in the example folder

Snack showcasing the new feature

@Kliorsapir
Copy link

Super nice!! :)

@pgandroid1289
Copy link

pgandroid1289 commented Apr 26, 2023

@leecade Please merge this link for adjustcant views

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

Successfully merging this pull request may close these issues.

3 participants