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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass id an index to renderImage callback #17

Closed
hanno-ferrannegre opened this issue Sep 29, 2020 · 6 comments
Closed

Pass id an index to renderImage callback #17

hanno-ferrannegre opened this issue Sep 29, 2020 · 6 comments

Comments

@hanno-ferrannegre
Copy link

Hey there 馃憢

I wanted to propose the following:

const renderImage = useCallback(
  ({source: {uri}, id, index, ...rest}) => (
    <CacheImage
      {...rest}
      uri={uri}
      // This
      testID={`image-${index}`}
      // Or 
      testID={`image-${id}`}
    />
  ),
  [],
);

It would be useful if we can get item.id in the callback and also index in case we want to use index.

@terrysahaidak
Copy link
Owner

Hey. I can see why would you want this.
I'm not sure I want to add this information directly to the renderImage, because it's coming from the ImageTransformer component that shouldn't know anything about index etc.

But I'll figure something out.

You're using Standalone Gallery?

@terrysahaidak
Copy link
Owner

Could you test these changes?

#18

@ferrannp
Copy link

You're using Standalone Gallery?

Yes.

Could you test these changes?
#18

@terrysahaidak works perfectly 馃憤

@terrysahaidak
Copy link
Owner

I added this only for standalone gallery

@ferrannp
Copy link

Thank you. Waiting for the release then 馃殌 .

@terrysahaidak
Copy link
Owner

This change is included in 1.0.0-alpha.1 :)

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

No branches or pull requests

3 participants