jobtoday/react-native-image-viewing

Orientation problem

ninjia0 opened this issue · 8 comments

if i start the app with portait mode image-viewing register it as const width so if i change the orientation to landscape, images showing half , abnormal. please fix this

Having the same problem. I experience the half image problem on Android, where as iOS simply doesn't change the orientation at all when I turn my phone to landscape.

any update on this

Seeing the same issue. Images loaded while the app is on landscape are incorrectly aligned on the screen. This affects us particularly on Android.

Has anyone found a workaround or an alternate library for this? This lib has too many issues to be production friendly.

+1

Is there any workaround for this issue?

Like everyone else, i had this problem and there was no easy fix, so i changed the library completely to react-native-image-zoom-viewer' by wrapping it into a modal and this works really fine and good for me.

I do not encourage you to change your library, but if you want to, here is what i did.

import React from "react";
import { StyleSheet, Image, View, Modal } from "react-native";

import ImageViewer from 'react-native-image-zoom-viewer';

export default function Index(props) {
const formattedImages = props?.arrayOfImages?.map(eachImageObj => ({url: eachImageObj.uri}))
return (<Modal
transparent={false}
visible={props?.visible}
presentationStyle={'overFullScreen'}
animationType={"fade"}
onRequestClose={props?.onRequestClose}
supportedOrientations={["portrait", "landscape"]}
hardwareAccelerated>
<ImageViewer
imageUrls={formattedImages}
index={props?.imageIndex ?? 0}
onChange={props?.onImageIndexChange}
saveToLocalByLongPress={false}
onSwipeDown={props?.onRequestClose}
enableSwipeDown={true}
backgroundColor={"#000"} doubleClickInterval={1000}
/>

);
}

view photo taken in landscape orientation, in "portrait" orientation for review, and save so it's not rotated i want to changed image path that is actually captured .