diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-12-16 11:57:45 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-12-16 11:57:45 -0600 |
commit | 3aded6887d8b89bccd7c8aa31306f94336ee1123 (patch) | |
tree | 184e7f732f244b1b64505df7a8e945efbc03f22f /src/view/com/lightbox/Images.tsx | |
parent | 3a44a1cfdcd664ebf71fdf7edc89c460acdaa558 (diff) | |
download | voidsky-3aded6887d8b89bccd7c8aa31306f94336ee1123.tar.zst |
Add swipe gestures to the lightbox
Diffstat (limited to 'src/view/com/lightbox/Images.tsx')
-rw-r--r-- | src/view/com/lightbox/Images.tsx | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/view/com/lightbox/Images.tsx b/src/view/com/lightbox/Images.tsx new file mode 100644 index 000000000..6f84dfe7c --- /dev/null +++ b/src/view/com/lightbox/Images.tsx @@ -0,0 +1,35 @@ +import React from 'react' +import {Image, StyleSheet, useWindowDimensions, View} from 'react-native' + +export function Component({uris, index}: {uris: string[]; index: number}) { + const winDim = useWindowDimensions() + const left = index * winDim.width * -1 + return ( + <View style={[styles.container, {left}]}> + {uris.map((uri, i) => ( + <Image + key={i} + style={[styles.image, {left: i * winDim.width}]} + source={{uri}} + /> + ))} + </View> + ) +} + +const styles = StyleSheet.create({ + container: { + position: 'absolute', + top: 0, + left: 0, + width: '100%', + }, + image: { + position: 'absolute', + top: 200, + left: 0, + resizeMode: 'contain', + width: '100%', + aspectRatio: 1, + }, +}) |