-
Notifications
You must be signed in to change notification settings - Fork 441
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
custom component as child rather than array of images as prop #54
Comments
Hi @vshesh, I recently encountered a similar issue when using this component in a commercial project -- I had to fork the code and adjust it to better suit the client's needs. I would love for this module to be generic enough that this isn't necessary and would really like any help doing so. |
I just committed a version on my fork that works in a limited sense - it doesn't replicate all the features of the original yet, but it's good enough for what I'm working on (I just wanted the slideshow behavior and to be able to render a custom component). This version takes 1 child component that will be the parent of the content displayed that receives as a prop the item, which is the currently rendered item. |
one question as i attempt to regain feature parity - how are you styling the images such that they always fit the box? http://jsbin.com/jejaveheni/edit?html,css,output that image will not go outside the red area no matter what you do, but trying to replicate that in the modal dialog of this component fails. |
I guess this would be the first problem with passing through a custom component, rather then generating an The image has specific styles to allow the responsive behaviour. |
Quick question, should we be able to pass components as children or should it just have a "renderer" prop that is called instead of the default image rendering ? @vshesh can you post an image of what your custom fork looks like to see how it could be achieved without having to fork the project ? If you are willing to use a plain div with |
Ref #87 As mentioned by @GregoryPotdevin we'll likely implement a "renderer" in the form of an |
@jossmac @GregoryPotdevin could custom components support other content like video (#163)? |
Not sure what the current state is, but in theory you could imagine that the custom component would receive all properties from the selected item, and not just the src/srcSet/captions. In that case you could render pretty much anything, and see react-images as something that handles thumbnail previews and left/right arrows buttons. |
@GregoryPotdevin the state is nothing but i'm cleaning up a lot of issues that ultimately point to this one. i think its the way forward. there are too many requests for custom things that i don't think is the job of this library. i enabled a custom (image) component for react-photo-gallery and the gallery has a lot more potential now. |
Resolved by component architecture in v1 #199 |
I'm happy to fork/modify this myself if needed, but I'm wondering if it would be possible to accept custom children components and render those instead of the images. What parts of the Lightbox component would I need to change?
I need to include a few buttons below the image, but I need to pass appropriate callbacks etc.
If there's a way to do that already, please let me know!
The text was updated successfully, but these errors were encountered: