-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathexamples.js
executable file
·94 lines (83 loc) · 2.62 KB
/
examples.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
import React from 'react'
import { View, Text, Button, TextInput } from 'react-native'
import CustomisableAlert, { showAlert, closeAlert } from "react-native-customisable-alert";
const App = () => {
return (
<View style={{ flex: 1, justifyContent: 'space-evenly', alignItems: 'center' }}>
<Text style={{ fontSize: 20, width: 300, textAlign: 'center' }}>react-native-customisable-alert showcase</Text>
<Button
title="Success Alert"
color='green'
onPress={() => showAlert({
title: 'Something went good!',
message: 'Your code works!',
alertType: 'success'
})}
/>
<Button
title="Warning Alert"
color='orange'
onPress={() => showAlert({
title: 'Are you sure?',
message: 'This action will be irreversible!',
alertType: 'warning',
onPress: () => alert('Too late now!')
})}
/>
<Button
title="Error Alert"
color='red'
onPress={() => showAlert({
title: 'Something went wrong!',
btnLabel: 'teste',
message: 'You have lost all your data, sorry!'
})}
/>
<Button
title="Custom Alert"
onPress={() => showAlert({
alertType: 'custom',
customAlert:
<View style={{ backgroundColor: 'black', padding: 20, width: '85%' }}>
<Text style={{ textAlign: 'center', fontSize: 18, marginBottom: 20, color: 'white' }}>Could you tell us your name?</Text>
<TextInput
style={{ borderWidth: 1, padding: 5, paddingHorizontal: 10, fontSize: 18, backgroundColor: 'white' }}
/>
<View style={{ flexDirection: 'row', justifyContent: 'space-evenly', marginTop: 30 }}>
<Button
title="Cancel"
onPress={() => closeAlert()}
/>
<Button
title="Send"
onPress={() => { }}
/>
</View>
</View>
})}
/>
<Button
title="Custom Animation Alert"
onPress={() => showAlert({
// title: 'Something went wrong!',
message: 'You have lost all your data, sorry!',
animationIn: 'tada',
animationOut: 'zoomOut'
})}
/>
<CustomisableAlert
dismissable
titleStyle={{
fontSize: 18,
fontWeight: 'bold'
}}
btnLabelStyle={{
color: 'white',
paddingHorizontal: 10,
textAlign: 'center',
}}
/>
</View>
)
}
export default App