-
Notifications
You must be signed in to change notification settings - Fork 157
Expand file tree
/
Copy pathApp.tsx
More file actions
154 lines (139 loc) · 4.47 KB
/
App.tsx
File metadata and controls
154 lines (139 loc) · 4.47 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
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
147
148
149
150
151
152
153
154
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @format
*/
import { NewAppScreen } from "@react-native/new-app-screen";
import {
StatusBar,
StyleSheet,
Text,
TouchableOpacity,
useColorScheme,
View,
} from "react-native";
import Snackbar from "react-native-snackbar";
import styles from "./styles";
function App() {
const isDarkMode = useColorScheme() === "dark";
return (
<View style={styles.container}>
<Text style={styles.title}>Snackbar Examples</Text>
<TouchableOpacity
onPress={() => Snackbar.show({ text: "Hello, World!" })}
>
<Text style={styles.button}>Simple Snackbar</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Hello, World!",
textAlignCenter: true,
})
}
>
<Text style={styles.button}>Align text center</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Hello, World! How are you doing today? Enjoying the sun?! This should wrap to two lines.",
duration: Snackbar.LENGTH_LONG,
})
}
>
<Text style={styles.button}>Simple Snackbar - two lines</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
duration: Snackbar.LENGTH_LONG,
numberOfLines: 5,
})
}
>
<Text style={styles.button}>Simple Snackbar - extra lines</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Please agree to this.",
duration: Snackbar.LENGTH_INDEFINITE,
action: {
text: "AGREE",
textColor: "green",
onPress: () => Snackbar.show({ text: "Thank you!" }),
},
})
}
>
<Text style={styles.button}>Snackbar with action</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Please agree to this.",
duration: Snackbar.LENGTH_INDEFINITE,
textColor: "blue",
backgroundColor: "silver",
fontFamily: "Lobster-Regular",
action: {
text: "AGREE",
textColor: "blue",
onPress: () => Snackbar.show({ text: "Thank you!" }),
},
})
}
>
<Text style={styles.button}>Snackbar with style</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "يرجى الموافقة على هذا.",
rtl: true,
duration: Snackbar.LENGTH_INDEFINITE,
action: {
text: "يوافق على",
textColor: "green",
onPress: () => Snackbar.show({ text: "شكرا لكم!", rtl: true }),
},
})
}
>
<Text style={styles.button}>Snackbar with RTL text</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Use a bottom margin to avoid covering navigational elements such as a tab bar.",
marginBottom: 500,
})
}
>
<Text style={styles.button}>Snackbar with bottom margin</Text>
</TouchableOpacity>
<TouchableOpacity
onPress={() =>
Snackbar.show({
text: "Use a bottom margin to avoid covering navigational elements such as a tab bar.",
marginHorizontal: 100,
})
}
>
<Text style={styles.button}>Snackbar with horizontal margin</Text>
</TouchableOpacity>
<TouchableOpacity onPress={() => Snackbar.dismiss()}>
<Text style={styles.button}>Dismiss active Snackbar</Text>
</TouchableOpacity>
</View>
);
}
// const styles = StyleSheet.create({
// container: {
// flex: 1,
// },
// });
export default App;