react-native-parallax-swiper icon indicating copy to clipboard operation
react-native-parallax-swiper copied to clipboard

Rendering from a list of data

Open borgogelli opened this issue 5 years ago • 3 comments

When I use the map function to render the component (see the code below) I get the following error: Invariant Violation: input range must be monotonically non-decreasing

  return (
      <ParallaxSwiper
        speed={0.5}
        animatedValue={this.myCustomAnimatedValue}
        dividerWidth={8}
        dividerColor="black"
        backgroundColor="black"
        onMomentumScrollEnd={activePageIndex => console.log(activePageIndex)}
        showProgressBar={true}
        progressBarBackgroundColor="rgba(0,0,0,0.25)"
        progressBarValueBackgroundColor="white"
      >
      {this.props.images.map((image) => (
      <ParallaxSwiperPage key={image.id} 
                    BackgroundComponent={
                      <Image style={styles.backgroundImage}
                        source={{ uri: image.uri }}
                      />
                    }                     
                  />                 
          ))
      } 
      </ParallaxSwiper>
    );

borgogelli avatar Jun 17 '19 08:06 borgogelli

If you make an Expo Snack I can take a look at it.

zachgibson avatar Jun 30 '19 00:06 zachgibson

@borgogelli you forgot to return the ParralaxSwiperPage items from the map function

nickmccomb avatar Nov 07 '19 07:11 nickmccomb

When I use the map function to render the component (see the code below) I get the following error: Invariant Violation: input range must be monotonically non-decreasing

  return (
      <ParallaxSwiper
        speed={0.5}
        animatedValue={this.myCustomAnimatedValue}
        dividerWidth={8}
        dividerColor="black"
        backgroundColor="black"
        onMomentumScrollEnd={activePageIndex => console.log(activePageIndex)}
        showProgressBar={true}
        progressBarBackgroundColor="rgba(0,0,0,0.25)"
        progressBarValueBackgroundColor="white"
      >
      {this.props.images.map((image) => (
      <ParallaxSwiperPage key={image.id} 
                    BackgroundComponent={
                      <Image style={styles.backgroundImage}
                        source={{ uri: image.uri }}
                      />
                    }                     
                  />                 
          ))
      } 
      </ParallaxSwiper>
    );

Please remove showProgressBar={true}

dhirajanand014 avatar Feb 16 '20 15:02 dhirajanand014