Skip to content

Commit 4aea181

Browse files
committed
chore: add new tab in the example app with all components
1 parent 3be9b39 commit 4aea181

File tree

2 files changed

+162
-1
lines changed

2 files changed

+162
-1
lines changed

example/src/App.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { ModalScreen } from './screens/ModalScreen';
1313
import { useAppStore } from './store';
1414
import { SafeAreaProvider } from 'react-native-safe-area-context';
1515
import { PositionsTabScreen } from './screens/PositionsTabScreen';
16+
import { ComponentsTabScreen } from './screens/ComponentsTabScreen';
1617

1718
const Stack = createNativeStackNavigator();
1819
const BottomTab = createBottomTabNavigator();
@@ -25,9 +26,14 @@ const TabsNavigator = () => {
2526
options={{ title: 'Home' }}
2627
component={HomeTabScreen}
2728
/>
29+
<BottomTab.Screen
30+
name="ComponentsTab"
31+
options={{ title: 'Components' }}
32+
component={ComponentsTabScreen}
33+
/>
2834
<BottomTab.Screen
2935
name="CustomAnimationsTab"
30-
options={{ title: 'Custom Animations' }}
36+
options={{ title: 'Animations' }}
3137
component={CustomAnimationsTabScreen}
3238
/>
3339
<BottomTab.Screen
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
import { ScrollView } from 'react-native';
2+
import { Notifier, NotifierComponents } from 'react-native-notifier';
3+
import Button from '../components/Button';
4+
5+
export const ComponentsTabScreen = () => {
6+
return (
7+
<ScrollView>
8+
<Button
9+
title="Toast: Successful"
10+
onPress={() =>
11+
Notifier.showNotification({
12+
title: 'Operation Successful!',
13+
description: 'Everything went smoothly.',
14+
Component: NotifierComponents.Toast,
15+
componentProps: {
16+
type: 'success',
17+
},
18+
})
19+
}
20+
/>
21+
<Button
22+
title="Toast: Warning"
23+
onPress={() =>
24+
Notifier.showNotification({
25+
title: 'Something is missing...',
26+
description: 'Please fill out all required fields.',
27+
Component: NotifierComponents.Toast,
28+
componentProps: {
29+
type: 'warn',
30+
},
31+
})
32+
}
33+
/>
34+
<Button
35+
title="Toast: Info"
36+
onPress={() =>
37+
Notifier.showNotification({
38+
title: 'Please check your inbox.',
39+
description: 'Your new credentials are active.',
40+
Component: NotifierComponents.Toast,
41+
componentProps: {
42+
type: 'info',
43+
},
44+
})
45+
}
46+
/>
47+
<Button
48+
title="Toast: Error"
49+
onPress={() =>
50+
Notifier.showNotification({
51+
title: 'Oops!',
52+
description: 'Something went wrong.',
53+
Component: NotifierComponents.Toast,
54+
componentProps: {
55+
type: 'error',
56+
},
57+
})
58+
}
59+
/>
60+
<Button
61+
title="Toast: No Internet"
62+
onPress={() =>
63+
Notifier.showNotification({
64+
title: "You're offline now",
65+
description: 'Opps! Internet is disconnected',
66+
Component: NotifierComponents.Toast,
67+
duration: 0,
68+
componentProps: {
69+
type: 'disconnected',
70+
},
71+
})
72+
}
73+
/>
74+
<Button
75+
title="Toast: Internet Connected"
76+
onPress={() =>
77+
Notifier.showNotification({
78+
title: "You're online now",
79+
description: 'Hurray! Internet is connected',
80+
Component: NotifierComponents.Toast,
81+
componentProps: {
82+
type: 'connected',
83+
},
84+
})
85+
}
86+
/>
87+
<Button
88+
title="SimpleToast"
89+
onPress={() =>
90+
Notifier.showNotification({
91+
title: 'Copied to clipboard!',
92+
Component: NotifierComponents.SimpleToast,
93+
})
94+
}
95+
/>
96+
<Button
97+
title="Notification: message"
98+
onPress={() =>
99+
Notifier.showNotification({
100+
title: 'John Doe',
101+
description: 'Hello! Can you help me with notifications?',
102+
})
103+
}
104+
/>
105+
<Button
106+
title="Notification: long message"
107+
onPress={() =>
108+
Notifier.showNotification({
109+
title: 'Lorem?',
110+
duration: 6000,
111+
description:
112+
'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.',
113+
})
114+
}
115+
/>
116+
<Button
117+
title="Notification: With Image"
118+
onPress={() =>
119+
Notifier.showNotification({
120+
title: 'Check this image!',
121+
description: 'Cool, right?',
122+
componentProps: {
123+
imageSource: require('../react.jpg'),
124+
},
125+
})
126+
}
127+
/>
128+
<Button
129+
title="Alert: Success"
130+
onPress={() =>
131+
Notifier.showNotification({
132+
title: 'Your profile was successfully saved!',
133+
Component: NotifierComponents.Alert,
134+
componentProps: {
135+
type: 'success',
136+
},
137+
})
138+
}
139+
/>
140+
<Button
141+
title="Alert: Error"
142+
onPress={() =>
143+
Notifier.showNotification({
144+
title: 'The request has failed',
145+
description: 'Please, check your internet connection',
146+
Component: NotifierComponents.Alert,
147+
componentProps: {
148+
type: 'error',
149+
},
150+
})
151+
}
152+
/>
153+
</ScrollView>
154+
);
155+
};

0 commit comments

Comments
 (0)