reactrondev/react-native-web-swiper

Even if image state is removed, it is visible in the swiper.

Opened this issue · 0 comments

images is string array state in react

If click the delete image state button, the image state is removed in the array, but the image is still visible on the swiper.

how to solve this problem?

<Swiper
    ref={ref}
    from={index}
    minDistanceForAction={0.1}
    onIndexChanged={(_index: number) => setIndex(_index)}
    controlsProps={{
      prevTitle: '',
      nextTitle: '',
      DotComponent:
        swiperType === 'dot'
          ? ({isActive}) => (
              <Circle
                width={'6px'}
                margin={'3px'}
                height={'6px'}
                backgroundColor={
                  isActive ? colors.fussOrange[0] : colors.scrim[60]
                }
              />
            )
          : () => <></>,
    }}
    controlsEnabled={
      swiperType === 'arrow' || images.length < 2 ? false : true
    }
    containerStyle={{
      width: imageWidth,
      height: imageWidth,
    }}>
    {images.map((item, i) => (
      <Image
        key={i.toString()}
        w={imageWidth}
        h={imageWidth}
        fallbackElement={
          <Center
            bgColor={colors.grayScale['10']}
            w={imageWidth}
            h={imageWidth}
          />
        }
        alt="post_img"
        source={{
          uri: `${item ?? ''}`,
        }}
      />
    ))}
</Swiper>