|
|
|
@ -1,9 +1,11 @@
|
|
|
|
|
import { StatusBar } from 'expo-status-bar';
|
|
|
|
|
import React, { useState } from 'react';
|
|
|
|
|
import React, { useEffect, 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';
|
|
|
|
|
import TopBar from '../components/TopBar';
|
|
|
|
|
import { useDispatch, useSelector } from 'react-redux';
|
|
|
|
|
import { addXlsFile } from '../redux/actions/sessions';
|
|
|
|
|
|
|
|
|
|
export default function NewTrack(props: { navigation: any }) {
|
|
|
|
|
const { navigation } = props;
|
|
|
|
@ -12,7 +14,7 @@ export default function NewTrack(props: { navigation: any }) {
|
|
|
|
|
|
|
|
|
|
const handlePickDocument = async () => {
|
|
|
|
|
try {
|
|
|
|
|
const result = await DocumentPicker.getDocumentAsync({ type: 'excel/xls' });
|
|
|
|
|
const result = await DocumentPicker.getDocumentAsync();
|
|
|
|
|
if (result.type === 'success') {
|
|
|
|
|
setPickedDocument(result);
|
|
|
|
|
}
|
|
|
|
@ -21,6 +23,15 @@ export default function NewTrack(props: { navigation: any }) {
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
//const nList = useSelector(state => state.appReducer.teams);
|
|
|
|
|
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
|
|
const onPressAddFile = async () => {
|
|
|
|
|
dispatch(await addXlsFile(pickedDocument));
|
|
|
|
|
navigation.goBack();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<SafeAreaView>
|
|
|
|
|
<View style={styles.container}>
|
|
|
|
@ -68,7 +79,7 @@ export default function NewTrack(props: { navigation: any }) {
|
|
|
|
|
source={require('../assets/images/return.png')}
|
|
|
|
|
/>
|
|
|
|
|
</Pressable>
|
|
|
|
|
<Pressable style={styles.button} onPress={() => navigation.goBack()}>
|
|
|
|
|
<Pressable style={styles.button} onPress={onPressAddFile}>
|
|
|
|
|
<Image
|
|
|
|
|
style={styles.return}
|
|
|
|
|
source={require('../assets/images/checked.png')}
|
|
|
|
|