Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should reset internal imageIndex state after close #180

Open
themez opened this issue Feb 9, 2023 · 1 comment · May be fixed by #181
Open

should reset internal imageIndex state after close #180

themez opened this issue Feb 9, 2023 · 1 comment · May be fixed by #181

Comments

@themez
Copy link

themez commented Feb 9, 2023

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 themez changed the title reset imageIndex after close should reset internal imageIndex state after close Feb 9, 2023
@themez themez linked a pull request Feb 9, 2023 that will close this issue
@eeshankeni
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants