react native how to recyclerlistview to center?

683 Views Asked by At

how can I center my recycerlistview items to center ?

if I want to use style then I get this error message:

Invariant Violation: ScrollView child layout (["alignItems","justifyContent"]) must be applied through the contentContainerStyle prop
  <View style={styles.container}>
    <RecyclerListView
      style={styles.recyclerlistview}
      rowRenderer={rowRenderer}
      dataProvider={dataprovider}
      layoutProvider={layoutprovider}
      scrollViewProps={{showsVerticalScrollIndicator: false}}
      externalScrollView={ScrollViewWithHeader}
    />
  </View>

styles...
  recyclerlistview: {
    flex: 1,
    width: width * 1,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#fff'
  },

But the recyclerlistview has no prop named contentcontainerstyle. Can anyone help me?

Lib: https://github.com/Flipkart/recyclerlistview

1

There are 1 best solutions below

0
Michael On

According to the docs, you can pass contentContainerStyle in scrollViewProps.

scrollViewProps

For all props that need to be proxied to inner/external scrollview. Put them in an object and they'll be spread and passed down.