From 237cd648874376a4420aaf8f3de21fa33c53ad90 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Sun, 18 Dec 2022 23:15:36 +1300 Subject: [PATCH] Allow images as well as videos --- App.tsx | 46 +++++++++++++------------------------ Item.tsx | 70 +++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 63 insertions(+), 53 deletions(-) diff --git a/App.tsx b/App.tsx index ce8c1d6..255b564 100644 --- a/App.tsx +++ b/App.tsx @@ -4,8 +4,8 @@ import DocumentPicker, { DocumentPickerResponse, types, } from 'react-native-document-picker' -import Video from 'react-native-video' import {backgroundColor} from './constants' +import Item from './Item' const buttonWidth = '45%' @@ -13,12 +13,11 @@ export default function App() { const [files, setFiles] = useState([]) const [selected, setSelected] = useState(0) const [paused, setPaused] = useState(false) - const [width, setWidth] = useState(0) - - const height = Dimensions.get('screen').height const pick = async () => { - const picked = await DocumentPicker.pickMultiple({type: types.video}) + const picked = await DocumentPicker.pickMultiple({ + type: [types.video, types.images], + }) setSelected(0) console.log(`Picked ${picked.length} files.`) setFiles(picked) @@ -47,29 +46,14 @@ export default function App() { padding: 10, }}> {files.length > 0 ? ( - - setPaused(!paused)}> - - - {files[selected].name} ({selected + 1}/ {files.length}) - + <> +