-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.tsx
69 lines (58 loc) · 1.66 KB
/
index.tsx
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/**
* @format
*/
import { GoogleSignin } from '@react-native-google-signin/google-signin'
import { GDrive } from '@robinbobin/react-native-google-drive-api-wrapper'
import React, { useEffect, useState } from 'react'
import { AppRegistry, SafeAreaView, ScrollView, StyleSheet } from 'react-native'
import { name } from './app.json'
import About from './src/About'
import Files from './src/Files'
import Permissions from './src/Permissions'
import MultipleResumableUpload from './src/MultipleResumableUpload'
const App: React.VFC = () => {
const [gdrive, setGDrive] = useState<GDrive>()
useEffect(() => {
GoogleSignin.configure({
scopes: [
'https://www.googleapis.com/auth/drive',
'https://www.googleapis.com/auth/drive.appfolder',
],
})
const init = async () => {
try {
await GoogleSignin.signIn()
const gdrv = new GDrive()
gdrv.accessToken = (await GoogleSignin.getTokens()).accessToken
gdrv.fetchTimeout = 3000
setGDrive(gdrv)
} catch (error) {
console.log(error)
}
}
init()
}, [])
return (
<SafeAreaView style={styles.container}>
<ScrollView
showsVerticalScrollIndicator={false}
style={styles.apiContainer}>
<About gdrive={gdrive} />
<Files gdrive={gdrive} />
<MultipleResumableUpload gdrive={gdrive} />
<Permissions gdrive={gdrive} />
</ScrollView>
</SafeAreaView>
)
}
const styles = StyleSheet.create({
apiContainer: {
marginBottom: 20,
},
container: {
backgroundColor: 'cyan',
flex: 1,
paddingHorizontal: 25,
},
})
AppRegistry.registerComponent(name, () => App)