intellidev1991 / react-native-image-slider-box

A simple and fully customizable React Native component that implements an Image Slider UI.
MIT License
289 stars 100 forks source link

Remove dynamically images #50

Open mldmix opened 4 years ago

mldmix commented 4 years ago

Hi

As seen on title i would like to remove dynamically images from slide, when i choose one image and remove it all images gone, i used index variable and put it in state to get current index, and just slice the item in array: setState({ images: this.state.images.splice(i, 1) })

bambomax commented 4 years ago

Hi

As seen on title i would like to remove dynamically images from slide, when i choose one image and remove it all images gone, i used index variable and put it in state to get current index, and just slice the item in array: setState({ images: this.state.images.splice(i, 1) })

Try setState({ images: this.state.images.filter((_, idx) => idx !== i })