Open Gabogg07 opened 4 years ago
Any updates regarding this
@jamesawer3 i couldn't manage to do it with this library, I had to use an slider component and adapt it for the different media types
@Gabogg07 , could be too late, but worth asking.
What are you using to display the video? I am using a react-native-video component inside the renderImage
function. Wrapping video inside a <View>
with flex: 1
does the job for me
@pavelnaumov Are you able to share more specifically what you used to get video to work? Perhaps it's due to a difference in version, but there are some weird styles on the parent container such that flex: 1
on a view in renderImage
does not have a set width and height. I haven't looked too much into this library code, but my understanding is that it's likely using the Image API to fix the width + height of the parent container.
For anyone interested, I can confirm that the width + height given to the parent container is proportional to the image size. You can provide the image size if you know it beforehand with the image
and width
parameters fields of your imageUrls
array. Since I did not have an aspect ratio or specific width/height for my videos, I used the dimensions of the window. These are the general steps I took:
Dimensions.get('window').width/height
for a given videoconst urls = content.map((c, index) => {
// check image/video
return { url, width, height, props: {index} };
});
enablePreload={false}
renderImage
:
const content; // Content[]
...
<ImageViewer
renderImage={image => {
const contentToRender: Content = content[image.props];
}}
/>
<View style={{flex: 1}}/>
react-native-image-viewer
so while click events work fine, dragging the seek bar/scrubbing also moves the gallery.resizeMode="contain"
using react-native-video
for the correct sizing on Androidconst urls = content.map((c, index) => { // check image/video return { url, width, height, props: {index} }; });
can you provide code?
I am trying to display images and videos inside the viewer, but can't figure out how to add the videos. I don't mind if they show at the end, but they been part of the numeric count, and the swipe motion is required.
Thanks