-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can not zoom, swipe list images when using Modal #35
Comments
I am also having the same issue.
Reproducible Code import React, { useState } from 'react';
import { FlatList, Modal, Image, Pressable, Dimensions } from 'react-native';
import { Container } from '../components'; // A View with flex: 1 and flexGrow: 1
import AwesomeGallery from 'react-native-awesome-gallery';
const { width } = Dimensions.get('screen');
const data = new Array(25).fill(
'https://cdn.stocksnap.io/img-thumbs/960w/business%20meeting-people_QVIEE1UZSX.jpg',
);
export const Gallery = () => {
const [modalVisible, setModalVisible] = useState(false);
const [initialIndex, setInitialIndex] = useState(0);
return (
<Container>
<FlatList
data={data}
keyExtractor={(item, index) => index + item}
numColumns={3}
renderItem={({ item, index }) => (
<Pressable
onPress={() => {
setInitialIndex(index);
setModalVisible(true);
}}
>
<Image
source={{ uri: item }}
style={{ height: width / 3, width: width / 3 }}
/>
</Pressable>
)}
/>
<Modal
visible={modalVisible}
transparent={true}
animationType="slide"
onRequestClose={() => setModalVisible(false)}
>
<AwesomeGallery
data={data}
initialIndex={initialIndex}
numToRender={10}
keyExtractor={(item, index) => index + item}
/>
</Modal>
</Container>
);
}; |
@phamhuuan Is it Android? |
It is on Android , |
@pavelbabenko yes it is on Android. |
I have tried with react-native-modal: |
You need to wrap the gallery with
<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 |
Tested on Android with v0.3.0. Everything worked well. |
react-native: 0.65.1
react-native-awessome-gallery: 0.2.6
react-native-reanimated: 2.2.3
Code
The text was updated successfully, but these errors were encountered: