diff --git a/R-Dash/screens/CreateTeam.tsx b/R-Dash/screens/CreateTeam.tsx index 2832e5c..2a836b8 100644 --- a/R-Dash/screens/CreateTeam.tsx +++ b/R-Dash/screens/CreateTeam.tsx @@ -1,10 +1,25 @@ -import React from 'react'; +import React, { useState } from 'react'; import { Button, Pressable } from 'react-native'; import { StyleSheet, Text, View, Image, TextInput } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; +import * as DocumentPicker from 'expo-document-picker'; export default function CreateTeam(props: { navigation: any }) { const { navigation } = props; + + const [pickedDocument, setPickedDocument] = useState(null); + + const handlePickDocument = async () => { + try { + const result = await DocumentPicker.getDocumentAsync({ type: ['image/png', 'image/jpeg', 'image/jpg'] }); + if (result.type === 'success') { + setPickedDocument(result); + } + } catch (err) { + console.log(err); + } + }; + return ( @@ -15,11 +30,11 @@ export default function CreateTeam(props: { navigation: any }) { style={styles.logo} source={require('../assets/images/image.png')} /> - - + + + + Picked document: {pickedDocument ? pickedDocument.name : 'none'} + diff --git a/R-Dash/screens/NewTrack.tsx b/R-Dash/screens/NewTrack.tsx index a11d2e5..2b6df27 100644 --- a/R-Dash/screens/NewTrack.tsx +++ b/R-Dash/screens/NewTrack.tsx @@ -1,10 +1,25 @@ import { StatusBar } from 'expo-status-bar'; -import React from 'react'; +import React, { useState } from 'react'; import { Button, Pressable, StyleSheet, Text, View, Image, TouchableOpacity, TextInput } from 'react-native'; import { SafeAreaView } from 'react-native-safe-area-context'; +import * as DocumentPicker from 'expo-document-picker'; export default function NewTrack(props: { navigation: any }) { const { navigation } = props; + + const [pickedDocument, setPickedDocument] = useState(null); + + const handlePickDocument = async () => { + try { + const result = await DocumentPicker.getDocumentAsync({ type: 'excel/xls' }); + if (result.type === 'success') { + setPickedDocument(result); + } + } catch (err) { + console.log(err); + } + }; + return ( @@ -51,11 +66,11 @@ export default function NewTrack(props: { navigation: any }) { Import file: - - + + + + Picked document: {pickedDocument ? pickedDocument.name : 'none'} +