about summary refs log tree commit diff
path: root/src/view/com/lightbox/Image.tsx
blob: a620e949e903d3a09c6e36e633186377c0014ec0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import React from 'react'
import {Image, StyleSheet, useWindowDimensions, View} from 'react-native'

export function Component({uri}: {uri: string}) {
  const winDim = useWindowDimensions()
  const top = winDim.height / 2 - (winDim.width - 40) / 2 - 100
  return (
    <View style={[styles.container, {top}]}>
      <Image style={styles.image} source={{uri}} />
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    position: 'absolute',
    left: 0,
  },
  image: {
    resizeMode: 'contain',
    width: '100%',
    aspectRatio: 1,
  },
})