meliorence / meliorence/react-native-snap-carousel

Question - Collapsable Header

Open
#677 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
10.5k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

Is this a bug report, a feature request, or a question?

Question

I am interested in making a collapsable header while using a Carousel in vertical orientation. I have an animated value listening to the onScroll event on the Carousel. As the user scrolls from the first item down, I make the height of the header smaller. This causes the Carousel to jump around and get really glitchy before going back to the first item. Is there a way to achieve a collapsable header without the Carousel spazzing out?

Thanks!

Example:


const headerHeightInterpolation = scrollOffsetY.current.interpolate({
        inputRange: [0, HEADER_SCROLL_DISTANCE],
        outputRange: [EXPANDED_HEADER_HEIGHT, COLLAPSED_HEADER_HEIGHT],
        extrapolate: 'clamp',
});

...

<View>
    <Animated.View style={{flex: 1, height: headerHeightInterpolation, marginBottom: 8}}>
        <Carousel vertical={true} ...restOfProps />
    </Animated.View>
</View>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the vertical Carousel configuration and the onScroll/Animated interpolation shown in the example. Reproduce the jump while changing the header height, then determine whether this interaction is supported. Done should be a documented, working approach or a clearly scoped resolution for the reported glitch.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.