Swiper/Item.tsx
2022-12-18 18:32:44 +13:00

36 lines
815 B
TypeScript

import {useState} from 'react'
import {Dimensions, View} from 'react-native'
import {DocumentPickerResponse} from 'react-native-document-picker'
import Video from 'react-native-video'
export default function Item({
slide,
value,
index,
}: {
slide: number
value: DocumentPickerResponse
index: number
}) {
const [paused, setPaused] = useState(false)
const [width, setWidth] = useState(0)
return (
<View style={{alignItems: 'center'}}>
<Video
paused={slide !== index}
style={{
height: Dimensions.get('screen').height - 125,
width,
alignItems: 'center',
}}
source={{uri: value.uri}}
resizeMode="contain"
onLoad={response => {
setWidth(response.naturalSize.width)
}}
/>
</View>
)
}