-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathApp.tsx
More file actions
51 lines (46 loc) · 1.32 KB
/
App.tsx
File metadata and controls
51 lines (46 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
import {SafeAreaView, StyleSheet, Text, View} from 'react-native';
import {ShareFile, useGetShare} from './src/useGetShare';
const App = () => {
const files = useGetShare();
const renderFile = (file: ShareFile, index: number) => {
return Object.keys(file).map((key: string, i: number) => {
// @ts-ignore
if (file[key]) {
return (
<Text key={`file${index}field${i}`}>
{/* @ts-ignore*/}
<Text style={{fontWeight: 'bold'}}>{key}</Text>: {file[key]}
</Text>
);
}
return null;
});
};
return (
<SafeAreaView style={styles.container}>
{files ? (
<>
{files?.map((file, index) => (
<View key={`file${index}`} style={styles.file}>
<Text style={styles.fileTitle}>File {index + 1}</Text>
{renderFile(file, index)}
</View>
))}
</>
) : (
<Text style={{color: 'black'}}>No files</Text>
)}
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {flex: 1, alignSelf: 'center', justifyContent: 'center'},
image: {width: 200, height: 200},
file: {
padding: 20,
borderWidth: 1,
},
fileTitle: {fontWeight: 'bold', backgroundColor: 'rgba(150, 150, 150, 0.3)'},
});
export default App;