meliorence / meliorence/react-native-snap-carousel

useScrollView - Warning: Function components cannot be given refs.

Open
#878 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

Issue is here:

https://github.com/meliorence/react-native-snap-carousel/blob/master/src/carousel/Carousel.js#L1357

Change to:

typeof(useScrollView) === 'object' || typeof(useScrollView) === 'function' ? useScrollView : AnimatedScrollView

Any component will be an object so we need to handle that case as well.

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 src/carousel/Carousel.js around line 1357 and inspect how useScrollView is selected for the ref. Verify the warning scenario and ensure the selection handles both object and function components as described. Done means the warning no longer occurs for the affected component types.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.