meliorence / meliorence/react-native-snap-carousel

this._getCustomDataLength is not a function.

Open
#525 6 comments 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

caused by calling e.g. setTimeout(this._carousel.snapToNext, 2000); in componentDidMount

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?

nope

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

both platforms

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

don't know

Environment

"react": "16.6.3",
"react-native": "0.58.6",
"react-native-snap-carousel": "^3.7.5",

Expected Behavior

should go from first to second element after loading page.

Actual Behavior

throws cryptic error message

(Write what happened. Add screencasts/screenshots!)

Reproducible Demo

https://snack.expo.io/BJsh_LE6V

Steps to Reproduce
  1. wait 2000ms
  2. observe error message
  3. remove lines 100-102
  4. repeat and notice different outcome

The reason I am doing this in the first place is because of problem where items are not rendered until the first swipe/scroll. Wasn't able to reproduce it. We use mobx, so data gets an ObservableArray, which still works as an array. However it results in a warning about data being and object instead of an array. But as I can't open an issue without reproducing, I am attaching this here.

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 componentDidMount call that passes this._carousel.snapToNext to setTimeout, using the linked Snack reproduction and its lines 100–102. Trace how the carousel reference and snapToNext call are handled, then verify that waiting 2000ms advances from the first to the second element without the _getCustomDataLength error on both platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react, 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.