-
Notifications
You must be signed in to change notification settings - Fork 64
/
App.js
146 lines (140 loc) · 4.63 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
134
135
136
137
138
139
140
141
142
143
144
145
146
import React, { Component } from 'react';
import { View, TouchableOpacity, Text, Image } from 'react-native';
// import { Popup } from 'popup-ui';
import Toast from './Toast';
import Root from './Root';
import Popup from './Popup';
class App extends Component {
render() {
return (
<Root>
<View
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#3498db',
}}>
<TouchableOpacity
onPress={() =>
Toast.show({
title: 'User created',
text: 'Your user was successfully created, use the app now.',
color: '#2ecc71',
timing: 2000,
icon: (
<Image
source={require('./assets/tick.png')}
style={{ width: 25, height: 25 }}
resizeMode="contain"
/>
),
})
}>
<Text>Toast Success</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Toast.show({
title: 'User deleted',
text:
'Your account has been deleted, you will no longer be able to access the app.',
color: '#e74c3c',
timing: 2000,
icon: (
<Image
source={require('./assets/close.png')}
style={{ width: 15, height: 15 }}
resizeMode="contain"
/>
),
})
}>
<Text>Toast Error</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Toast.show({
title: 'Profile edited',
text:
'Your profile has been edited, you can now see your new information.',
color: '#f39c12',
timing: 2000,
icon: (
<Image
source={require('./assets/warning.png')}
style={{ width: 25, height: 25 }}
resizeMode="contain"
/>
),
})
}>
<Text>Toast Warning</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Popup.show({
type: 'Success',
title: 'Upload complete',
button: true,
textBody: 'Congrats! Your upload successfully done',
buttontext: 'Ok',
icon: (
<Image
source={{
uri:
'https://www.acejundiai.com.br/wp-content/uploads/2018/12/success-icon-09.png',
}}
style={{ width: 50, height: 50 }}
resizeMode="contain"
/>
),
})
}>
<Text>Popup with Component Icon</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Popup.show({
type: 'Success',
title: 'Upload complete',
button: false,
textBody: 'Congrats! Your upload successfully done',
buttontext: 'Ok',
autoClose: true,
})
}>
<Text>Popup Success</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Popup.show({
type: 'Warning',
title: 'Upload attention',
textBody:
'Your file is over 3MB, this may harm your application',
buttontext: 'Continue',
callback: () => Popup.hide(),
})
}>
<Text>Popup Warning</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Popup.show({
type: 'Danger',
title: 'Upload failed',
textBody:
'Sorry! Your upload failed, please try again Sorry! Your upload failed, please try again Sorry! Your upload failed, please try again Sorry! Your upload failed, please try again Sorry! Your upload failed, please try again Sorry! Your upload failed, please try again',
buttontext: 'Try again',
callback: () => Popup.hide(),
})
}>
<Text>Popup Danger</Text>
</TouchableOpacity>
</View>
</Root>
);
}
}
export default App;