question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not zoom, swipe list images when using Modal

See original GitHub issue

react-native: 0.65.1 react-native-awessome-gallery: 0.2.6 react-native-reanimated: 2.2.3

Code

<Modal visible={true}>
	<Gallery
		ref={galleryRef}
		data={props.imageUrls}
		maxScale={10}
		initialIndex={props.defaultIndex}
		onIndexChange={setSelectedImage}
	/>
</Modal>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
kamui545commented, Oct 26, 2021

You need to wrap the gallery with GestureHandlerRootView if you’re using it inside a modal on Android.

import { GestureHandlerRootView } from 'react-native-gesture-handler';

<Modal
  visible={viewerVisible}
  animationType="fade"
  transparent
  onRequestClose={closeViewer}>
  <GestureHandlerRootView style={{ flex: 1 }}>
    <Gallery
      data={images}
      onSwipeToClose={closeViewer}
      onIndexChange={onGalleryIndexChange}
      initialIndex={viewerPhoto}
    />
  </GestureHandlerRootView>
</Modal>

Maybe this could be handled by the library itself? @pavelbabenko

https://docs.swmansion.com/react-native-gesture-handler/docs/#for-library-authors

0reactions
pavelbabenkocommented, Mar 19, 2022

Tested on Android with v0.3.0. Everything worked well. Note: v0.3.0 uses Gesture Handler v2 I’m closing the issue, but if the bug appears, please reopen it again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I prevent the image in the background from zooming ...
I have 4 pictures and a background image and I wrote a modal for each of them. When I click on the image...
Read more >
The Essential Ionic Image Zoom Guide (Modal & Cards)
Implement Ionic image zoom within a modal with transparent background, Ionic image zoom from code and a Instagram like list zoom !
Read more >
The Essential Ionic Image Zoom Guide (Modal & Cards)
There is a section inside the Swiper API about image zoom, which is all we need! To zoom images within the Ionic slides,...
Read more >
react-medium-image-zoom - npm
Start using react-medium-image-zoom in your project by running `npm i ... Tell the component whether or not it should be zoomed // Default: ......
Read more >
Modal - Bootstrap
Modals are built with HTML, CSS, and JavaScript. · Clicking on the modal “backdrop” will automatically close the modal. · Bootstrap only supports...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found