question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

this._getCustomDataLength is not a function.

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6

github_iconTop GitHub Comments

4reactions
ali-iocommented, Apr 2, 2020

note sure if you’re still looking for the solution but I just had this issue and solved it.

the snapTo function is getting assigned to the press before the ref is established, I’m using a functional component with the useRef hook along with encapsulating all my onPress with arrow functions just to avoid binding issues

conts Demo = props => {
const myCarousel = useRef();
return(
<View>
<Carousel ref={myCarousel}/>
<Button title="next" opPress={() => myCarousel.current.snapToNext()}/>
</View>
)
}
1reaction
rajjeetcommented, Sep 18, 2019

Workaround that I’m using is to wrap snapToNext in a function to defer its execution. Looking for a better solution myself.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: $(...).size is not a function - Stack Overflow
After replacing size() with length , it turned out that the actual problem is reference to non-existnent element.
Read more >
TypeError: "x" is not a function - JavaScript - MDN Web Docs
The JavaScript exception "is not a function" occurs when there was an attempt to call a value from a function, but the value...
Read more >
How to Handle JavaScript Uncaught TypeError: “x” is Not a ...
The Javascript TypeError: "x" is not a function occurs when calling a function on a value or object, which is not actually a...
Read more >
How to solve the "is not a function" error in JavaScript
js we use require() to load external modules and files. This can cause, in some cases, an error like this: TypeError: require(...) is...
Read more >
Uncaught TypeError | Is Not A Function | Solution - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found