react-native-parallax-scroll-view icon indicating copy to clipboard operation
react-native-parallax-scroll-view copied to clipboard

ListView flex grid not working

Open bitsagarob opened this issue 8 years ago • 1 comments

If we'd like to use the parallax scroll view as a grid, a basic example can be seen at this SO question, the style is not applied. I believe the flex style applied to ListView somehow gets overwritten by the parallax view. This is a simplified setup:

<ListView
  ref="ListView"
  contentContainerStyle={styles.list}
  dataSource={this.state.dataSource}
  renderRow={this.renderCategories}
  renderScrollComponent={props => (
<ParallaxScrollView
    ...

On the stylesheet:

list: {
  flexDirection: 'row',
  flexWrap: 'wrap'
},
item: {
  fontSize: 18,
  margin: 5,
  width: 100
}

Is this a bug? How could we get a flex grid working within the render row of the parallax view? Thank you.

bitsagarob avatar Apr 26 '16 09:04 bitsagarob

My pull request resolves this issue, it allows you to specify the property contentContainerStyle on the <ParallaxScrollView>. Which you can see in my fork's test branch.

      <ListView
        ref="ListView"
        style={styles.container}
        dataSource={ this.state.dataSource }
        renderRow={(rowData) => (
          <View key={rowData} style={ styles.row }>
            <Text style={ styles.rowText }>
              { rowData }
            </Text>
          </View>
         )}
        renderScrollComponent={props => (
          <ParallaxScrollView
            onScroll={onScroll}

            headerBackgroundColor="#333"
            stickyHeaderHeight={ STICKY_HEADER_HEIGHT }
            parallaxHeaderHeight={ PARALLAX_HEADER_HEIGHT }
            backgroundSpeed={10}
            contentContainerStyle={styles.contentContainer}

            renderBackground={() => (
            ...

alaycock avatar May 02 '16 18:05 alaycock