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