Merge branch 'Import' into Dev

Backend/Page/Team_Browser
mohamed 2 years ago
commit 5123771c8d

@ -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<DocumentPicker.DocumentResult | null>(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 (
<SafeAreaView style={styles.container}>
<View style={styles.maincard}>
@ -15,11 +30,11 @@ export default function CreateTeam(props: { navigation: any }) {
style={styles.logo}
source={require('../assets/images/image.png')}
/>
<Pressable>
<Image
style={styles.import}
source={require('../assets/images/import.png')}
/>
<Pressable onPress={handlePickDocument}>
<Image style={styles.import} source={require('../assets/images/import.png')} />
<Text>
Picked document: {pickedDocument ? pickedDocument.name : 'none'}
</Text>
</Pressable>
</View>

@ -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<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 (
<SafeAreaView>
<View style={styles.container}>
@ -51,11 +66,11 @@ export default function NewTrack(props: { navigation: any }) {
<View style={styles.placement}>
<Text style={{ paddingTop: 30 }}>Import file: </Text>
<Pressable>
<Image
style={styles.import}
source={require('../assets/images/import.png')}
/>
<Pressable onPress={handlePickDocument}>
<Image style={styles.import} source={require('../assets/images/import.png')} />
<Text>
Picked document: {pickedDocument ? pickedDocument.name : 'none'}
</Text>
</Pressable>
</View>

Loading…
Cancel
Save