react-native-image-viewing icon indicating copy to clipboard operation
react-native-image-viewing copied to clipboard

should reset internal imageIndex state after close

Open themez opened this issue 2 years ago • 1 comments

I have a image list, click a specific item in the list would trigger image viewing modal open and show the clicked image.

import ImageView from 'react-native-image-viewing'

function MyImageViewer(props){
  return <ImageView
      images={props.images}
      imageIndex={props.imageIndex}
      visible={props.visible}
      swipeToCloseEnabled={true}
      HeaderComponent={(imageIndex) => <Text>{imageIndex}</Text>}
      FooterComponent={(imageIndex) => <Text>{imageIndex}</Text>}
    />
}

The abnormal case is like that:

  1. click the first image to open image viewing modal and the modal presents image-0
  2. swipe to second image, the modal presents image-1
  3. close the image viewing modal
  4. click the first image to open image viewing modal
  5. the modal presents image-0, but the header and foot component received older imageIndex param: 1

themez avatar Feb 09 '23 08:02 themez

Thanks for the fix man, wish this package was actually maintained

eeshankeni avatar Sep 04 '23 09:09 eeshankeni