forked from mrzachnugent/react-native-reusables
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
58 lines (57 loc) · 1.55 KB
/
index.tsx
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
import { View } from 'react-native';
import { Button } from '~/components/deprecated-ui/button';
import Toast from 'react-native-toast-message';
import {
Alert,
AlertDescription,
AlertTitle,
} from '~/components/deprecated-ui/alert';
export default function ToastScreen() {
function showSuccessToast() {
Toast.show({
type: 'success',
text1: 'Success!',
text2:
'You have successfully completed the tutorial. You can now go touch some grass.',
});
}
function showErrorToast() {
Toast.show({
type: 'error',
text1: 'Danger!',
text2:
'High voltage. Do not touch. Risk of electric shock. Keep away from children.',
});
}
function showBaseToast() {
Toast.show({
type: 'base',
text1: 'Heads up!',
text2: 'You can use a terminal to run commands on your computer.',
props: {
icon: 'Terminal',
},
});
}
return (
<>
<View className='flex-1 justify-center items-center gap-5'>
<Button onPress={showSuccessToast}>Show success toast</Button>
<Button variant='destructive' onPress={showErrorToast}>
Show error toast
</Button>
<Button variant='secondary' onPress={showBaseToast}>
Show base toast
</Button>
</View>
<View className='p-6 w-full'>
<Alert icon='Code' className='max-w-xl'>
<AlertTitle>FYI</AlertTitle>
<AlertDescription>
This reusable does not use "rn-primitives"
</AlertDescription>
</Alert>
</View>
</>
);
}