Will this library have Landscape Orientation support? Is it still maintained?
Sorry, this library is not support Landscape Orientation yet, but welcome pr!
You can building this project by this command:
yarn
npm start
I would develop Landscape support if I knew :( i can't seem to find any library with landscape support
@itswaze you could give a chance to https://github.com/ldn0x7dc/react-native-transformable-image
I used:
...
"react-native-orientation": "3.1.0"
...
in my project and trigger this component redraw on orientation change.
Mostly because I have a lot of dependencies and can't migrate easily from ReactNative 0.42 (later versions have orientation change support in Dimensions class).
But of course it would be nice to have this feature implemented by awesome guys.
Thanks for this component!
Really love this component, so I thought I would add my two cents here if people are confused about implementing this.
I used a similar method to @nosshar by using react-native-orientation to manage the orientation changes in my application.
I first lock the orientation to portrait in the componentDidMount of my root app component.
To display the image I created a modal overlay that is hooked into redux. By calling a specific redux action I can pass an image uri to the modal overlay and tell it to become visible.
In the ImageModal I use ImageView to display the image that is passed to it. In the ImageModal
@andrewmarmion
Which key are you changing to trigger re rendering?
@vvavepacket as simply as this
<ImageViewer
key={this.state.render}
...
/>
So in my orientationDidChange, I set the state of render with a random number, that way it will always force a render. It may not be the best way of doing it but it is working quite nicely.
Please see my PR for this issue: https://github.com/ascoders/react-native-image-viewer/pull/178
Supposedly this PR was merged into master but when I open the image viewer it shows only in portrait. Was this fixed or is still in development?
Thanks.
Edit:
Actually it works in real devices, it just doesn't work in the emulator.
<Modal supportedOrientations={['landscape', 'portrait']} visible={imageVisible}>
<ImageViewer
saveToLocalByLongPress={false}
onSwipeDown={() => setIsImageVisible(false)}
onCancel={() => setIsImageVisible(false)}
enableSwipeDown
imageUrls={[
{
url: '',
props: {
// Or you can set source directory.
source: IMAGE.DUMMY_QUESTION,
},
},
]}
/>
</Modal>
Most helpful comment
Really love this component, so I thought I would add my two cents here if people are confused about implementing this.
I used a similar method to @nosshar by using react-native-orientation to manage the orientation changes in my application.
I first lock the orientation to portrait in the componentDidMount of my root app component.
To display the image I created a modal overlay that is hooked into redux. By calling a specific redux action I can pass an image uri to the modal overlay and tell it to become visible.
In the ImageModal I use ImageView to display the image that is passed to it. In the ImageModal