|
|
@ -1,10 +1,25 @@
|
|
|
|
import { StatusBar } from 'expo-status-bar';
|
|
|
|
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 { Button, Pressable, StyleSheet, Text, View, Image, TouchableOpacity, TextInput } from 'react-native';
|
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
|
|
import { SafeAreaView } from 'react-native-safe-area-context';
|
|
|
|
|
|
|
|
import * as DocumentPicker from 'expo-document-picker';
|
|
|
|
|
|
|
|
|
|
|
|
export default function NewTrack(props: { navigation: any }) {
|
|
|
|
export default function NewTrack(props: { navigation: any }) {
|
|
|
|
const { navigation } = props;
|
|
|
|
const { navigation } = props;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [pickedDocument, setPickedDocument] = useState<DocumentPicker.DocumentResult | null>(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 (
|
|
|
|
return (
|
|
|
|
<SafeAreaView>
|
|
|
|
<SafeAreaView>
|
|
|
|
<View style={styles.container}>
|
|
|
|
<View style={styles.container}>
|
|
|
@ -51,11 +66,11 @@ export default function NewTrack(props: { navigation: any }) {
|
|
|
|
|
|
|
|
|
|
|
|
<View style={styles.placement}>
|
|
|
|
<View style={styles.placement}>
|
|
|
|
<Text style={{ paddingTop: 30 }}>Import file: </Text>
|
|
|
|
<Text style={{ paddingTop: 30 }}>Import file: </Text>
|
|
|
|
<Pressable>
|
|
|
|
<Pressable onPress={handlePickDocument}>
|
|
|
|
<Image
|
|
|
|
<Image style={styles.import} source={require('../assets/images/import.png')} />
|
|
|
|
style={styles.import}
|
|
|
|
<Text>
|
|
|
|
source={require('../assets/images/import.png')}
|
|
|
|
Picked document: {pickedDocument ? pickedDocument.name : 'none'}
|
|
|
|
/>
|
|
|
|
</Text>
|
|
|
|
</Pressable>
|
|
|
|
</Pressable>
|
|
|
|
</View>
|
|
|
|
</View>
|
|
|
|
|
|
|
|
|
|
|
|