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.

Invariant Violation: VirtualizedList: The windowSize prop must be present and set to a value greater than 0

See original GitHub issue

I am getting error as shown in the title react-native: 0.56.0 react-native-snap-carousel: ^3.7.2

const horizontalMargin = 20;
const slideWidth = 280;

const sliderWidth = Dimensions.get("window").width;
const itemWidth = slideWidth + horizontalMargin * 2;
const itemHeight = 100;
//

_renderItem = ({ item }) => {
    return (
      <View style={style.slide}>
        <View style={style.slideInnerContainer} />
      </View>
    );
  };
  render() {
    return (
      <View style={style.container}>
        <Carousel
          data={[{ key: "1" }, { key: "2" }, { key: "3" }]}
          renderItem={this._renderItem}
          slideWidth={sliderWidth}
          itemWidth={itemWidth}
        />
      </View>
    );
  }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:8
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

17reactions
yasir-netlinkscommented, Jul 21, 2018

Ok I added windowSize={1} and it worked

12reactions
viv3kkcommented, Apr 12, 2019

provide both sliderWidth={400} itemWidth={400}

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invariant Violation: VirtualizedList: The windowSize prop ...
Invariant Violation : VirtualizedList: The windowSize prop must be present and set to a value greater than 0.
Read more >
React Native Snap Carousel: Invariant Violation
js where it expects inputRange for interpolation to be an array of numbers. So my best guess is react-native-snap-carousel uses itemWidth value ......
Read more >
VirtualizedList
This includes the data prop and parent component state. In order to constrain memory and enable smooth scrolling, content is rendered ...
Read more >
FlatList listKey
[React Native Flatlist] getting 'Invariant Violation: `refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `undefined`' Close....
Read more >
Understand onViewableItemsChanged in FlatList - RY 's Blog
onViewableItemsChanged is a prop in VirtualizedList and FlatList. ... Minimum amount of time (in milliseconds) that an item must be ...
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