meliorence / meliorence/react-native-snap-carousel

Invalid prop useScrolllView when using custom component

Open
#705 2 comments 5 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?

Bug report

Have you followed the required steps before opening a bug report?

(Check the step you've followed - put an x character between the square brackets ([]).)

Have you made sure that it wasn't a React Native bug?

Yes

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Happens on both platforms

Is the bug reproductible in a production environment (not a debug one)?

Yes

Environment

Environment:
React: 16.9.0
React native: 0.62.2
react-native-snap-carousel: 3.9.1

Target Platform:
Android (10)
iOS (13.5)

Expected Behavior

Should use the provided ScrollView/FlatList component

Actual Behavior

Warning: Failed prop type: Invalid prop useScrollView supplied to Carousel.

Reproducible Demo

(Paste the link to a Snack example in which the issue can be reproduced. Please follow the guidelines for providing a Minimal, Complete, and Verifiable example.)

Steps to Reproduce

(Write your steps so that anyone can reproduce the issue in the Snack demo you provided.)

  1. Create a Carousel component as usual
  2. Import ScrollView from react-native-gesture-handler
  3. Create Animatable Component
    const AnimatedScrollView = Animated.createAnimatedComponent(ScrollView);
  4. Pass the AnimatedScrollView component to useScrollView prop as described in the docs
    <Carousel useScrollView={AnimatedScrollView}
  5. The warning occurs and the Carousel won't use the custom component

Since version 3.7.6, this prop also accepts a custom scroll component (see #498 for more info).

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 at the Carousel component's useScrollView prop and compare its prop validation with the documented custom AnimatedScrollView usage. Reproduce with react-native-gesture-handler's ScrollView and Animated.createAnimatedComponent; done means the warning is gone and Carousel uses the provided component on Android and iOS.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.