jobtoday / react-native-image-viewing

Tiny, purely TS, modal component for viewing images 🏙
https://exp.host/@antonkalinin/react-native-image-viewing
MIT License
880 stars 286 forks source link

no orientation support for android and ios #53

Open kalyanijamunkar10 opened 4 years ago

kalyanijamunkar10 commented 4 years ago

images shows incorrectly in landscape mode

feliperaul commented 4 years ago

In my tests, even tough all my app reorients itself when in landscape mode, the continues to be rendered in portrait mode

kalyanijamunkar10 commented 4 years ago

@feliperaul try using react-native's Modal with react-native-image-zoom-viewer. This worked for me. you need to add supportedOrientations={['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']} in Modal.

sakshya73 commented 2 years ago

If you need orientation support, you can use react-native-zoom-viewer like this.

<Modal visible={visible}>
      <ImageViewer
        renderIndicator={() => null}
        onSwipeDown={() => setIsVisible(false)}
        maxOverflow={0}
        renderHeader={() => (
          <Pressable
            alignSelf="flex-end"
            right={4}
            top={20}
            zIndex={1}
            position="absolute"
            onPress={() => setIsVisible(false)}
          >
            <Icon
              name="white-cross-new"
              alt="white-cross-new"
              height={32}
              width={32}
            />
          </Pressable>
        )}
        enableSwipeDown={true}
        imageUrls={[
          {
            url: imageUrl,
            props: {
              style: {
                transform: [{ rotate: "90deg" }],
              },
            },
          },
        ]}
      />
    </Modal>