import React, { Dispatch, ReactNode, SetStateAction, useState } from 'react'; import { Dimensions, Image, Modal, StyleSheet, SafeAreaView, TouchableWithoutFeedback, ScrollView, } from 'react-native'; import { Box } from '../Box'; import { TouchableComponent } from '../TouchableComponent'; import { X } from 'phosphor-react-native'; interface ILightBox { show: boolean; setShow: Dispatch>; } export interface WithOutImage extends ILightBox { uri?: never; body: ReactNode; } export interface WithImage extends ILightBox { uri: string; body?: ReactNode; } export const LightBox = ({ show, setShow, uri, body, }: WithOutImage | WithImage) => { const { width } = Dimensions.get('window'); return ( setShow(!show)} > setShow(false)}> setShow(false)} testID="lightBoxCloseButton" > {uri && ( )} {body && body} ); }; const RemoteImage = ({ _uri, _desiredWidth, }: { _uri: string; _desiredWidth: number; }) => { const [desiredHeight, setDesiredHeight] = useState(0); Image.getSize(_uri, (_width, _height) => { setDesiredHeight((_desiredWidth / _width) * _height); }); const styles = StyleSheet.create({ image: { borderRadius: 4, width: _desiredWidth, height: desiredHeight, }, }); return ; }; const scrollview = StyleSheet.create({ container: { flexGrow: 1 }, });