This repository has been archived by the owner on Jan 15, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
133 lines (128 loc) · 2.58 KB
/
App.js
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
import React from 'react'
import {
View,
Text,
Image,
StyleSheet,
StatusBar,
Platform,
Picker
} from 'react-native'
import RNPickerSelect from 'react-native-picker-select'
const imageTypes = [
'hass',
'hmidriff',
'pgif',
'4k',
'hentai',
'holo',
'hneko',
'neko',
'hkitsune',
'kemonomimi',
'anal',
'hanal',
'gonewild',
'kanna',
'ass',
'pussy',
'thigh',
'hthigh',
'gah',
'coffee',
'food'
]
const App = () => {
const [type, setType] = React.useState('food')
const [image, setImage] = React.useState(undefined)
const refrash = async () => {
const res = await fetch(
`https://nekobot.xyz/api/image${
typeof type !== 'undefined' ? `?type=${type}` : ''
}`
)
setImage(JSON.parse(await res.text()))
}
React.useEffect(
() => {
refrash()
},
[type]
)
return (
<View style={styles.root}>
{Platform.OS === 'ios' && <StatusBar barStyle='default' />}
{typeof image !== 'undefined' ? (
<View>
<View style={styles.blank} />
<Image
style={styles.image}
source={{ uri: image.message }}
resizeMode='contain'
/>
<View style={styles.blank}>
<RNPickerSelect
placeholder={{
label: 'Select Type...',
value: null,
color: '#9EA0A4'
}}
onValueChange={(value) => setType(value)}
style={pickerSelectStyles}
items={imageTypes.map((x) => {
return { label: x, value: x }
})}
onDonePress={() => {
refrash()
}}
/>
</View>
</View>
) : (
<Text>Wait for a moment please...</Text>
)}
</View>
)
}
export default App
const styles = StyleSheet.create({
root: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: 'white',
flexDirection: 'column',
paddingHorizontal: 10
},
image: {
flex: 2,
height: 1024,
width: 1024,
alignSelf: 'center'
},
blank: {
flex: 1,
alignItems: 'center',
justifyContent: 'center'
}
})
const pickerSelectStyles = StyleSheet.create({
inputIOS: {
fontSize: 16,
paddingVertical: 12,
paddingHorizontal: 10,
borderWidth: 1,
borderColor: 'gray',
borderRadius: 4,
color: 'black'
},
inputAndroid: {
fontSize: 16,
paddingHorizontal: 10,
paddingVertical: 8,
borderWidth: 0.5,
borderColor: 'gray',
borderRadius: 8,
color: 'black'
}
})