alwx / react-native-photo-view

Pinch-to-zoom view for React Native (both iOS and Android)
MIT License
816 stars 435 forks source link

Image doesn't rescale when you change orientation #117

Closed narodejesus closed 6 years ago

narodejesus commented 6 years ago

The image doesn't rescale if you change the orientation in IOS in android works perfectly

here is the screenshot

screen shot 2017-10-05 at 3 52 22 pm screen shot 2017-10-05 at 3 52 28 pm
computerjazz commented 6 years ago

The PhotoVIew doesn't seem to respect new width and height on orientation change. My workaround is to set a key on the PhotoView to force a rerender on orientation change:

            <PhotoView
                  key={`PhotoView-landscape-${isLandscape}`}
                    source={{uri: image}}
                    minimumZoomScale={1}
                    maximumZoomScale={10}
                    androidScaleType="fitCenter"
                    onLoad={() => console.log("Image loaded!")}
                    style={{ width: isLandscape ? deviceHeight : deviceWidth }}
                  />
narodejesus commented 6 years ago

thanks @computerjazz .. it works though it result some minor flickers