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

FIX - 814 - Clickable image on the cards #2506

Conversation

sudeepto-dutta
Copy link
Contributor

This Pull Request tries to solve the issue 816 by following the instructions given by @flyingcircle in this comment,

  • I have added onPress and onLongPress props to <Image /> component.
  • I have also made sure that <Component> inside the <Image /> component is set based on whether the user has passed either the onPress or onLongPress props or not. For inspiration, I have followed the <Avatar /> component.
  • By doing the aforementioned changes, we can make use of imageProps prop in <Card /> component to pass onPress or onLongPress function props.
  • Added appropriate types in the index.d.ts file.
  • Added documentation in the image.md file for onPress and onLongPress props.

Let me know if any change is required in this Pull Request or not.

Thank You.

1. Added support for '<TouchableOpacity>' or '<View>' based on whether 
‘onPress’ or ‘onLongPress’ prop is passed or not.
2. Added support for ‘onPress’ and ‘onLongPress’ function props for '<Image>' component.
3. Added types in the ‘index.d.ts’ type definition file for aforementioned props.
@codecov
Copy link

codecov bot commented Aug 15, 2020

Codecov Report

Merging #2506 into next will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             next    #2506   +/-   ##
=======================================
  Coverage   93.10%   93.10%           
=======================================
  Files          40       40           
  Lines         769      769           
  Branches      115      115           
=======================================
  Hits          716      716           
  Misses         49       49           
  Partials        4        4           
Impacted Files Coverage Δ
src/image/Image.js 100.00% <ø> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c493931...2ee745f. Read the comment docs.

@flyingcircle
Copy link
Collaborator

This looks like a really clean solution! I'll test it out soon!

@flyingcircle flyingcircle linked an issue Aug 15, 2020 that may be closed by this pull request
@flyingcircle flyingcircle merged commit 7150f29 into react-native-elements:next Aug 18, 2020
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 this pull request may close these issues.

Clickable image on the cards
2 participants