Issue with the Getting Started Guide

Hi o/

I’m trying to implement a simple example on react-native with react-instantsearch.

My dependencies versions are :
"react-native": "0.42.x", "react": "^15.4.1", "react-instantsearch": "^4.3.0"

However, i’m facing an issue when i try to implement the Hits with connectInfiniteHits.

My Hits Component is such as :

const Hits = connectInfiniteHits(({ hits, hasMore, refine }) => {
const onEndReached = () => {
  if (hasMore) {
    refine();
  }
};

return (
  <FlatList
    data={hits}
    onEndReached={onEndReached}
    keyExtractor={(item, index) => item.objectID}
    renderItem={({ item }) => {
      return (
        <View style={{ flexDirection: 'row', alignItems: 'center' }}>
          <Image
            style={{ height: 100, width: 100 }}
            source={{ uri: item.image }}
          />
          <View style={{ flex: 1 }}>
          <Text>
            {item.name}
          </Text>
          <Text>
            {item.type}
          </Text>
        </View>
      </View>
    );
  }}
/>
);
});

export default Hits; 

And i’m simply them importing it and calling inside my <InstantSearch> implementation.

Here is a screenshot of what i have im simulator.

Thanks for taking a bit of your time for me :slight_smile:

For those having the same issue as @louis it’s because FlatList is available only since v0.43 of React Native.

If you’re using the v0.42, you should use ListView instead.

We are updating our guide to mention this.

Thanks @louis for letting us know.