-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathApp.tsx
133 lines (129 loc) · 3.54 KB
/
App.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
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
import * as React from 'react';
import {
SafeAreaView,
Button,
StatusBar,
StyleSheet,
View,
} from 'react-native';
import { Image } from 'expo-image';
import { Box } from './components/Box';
import { Heading, Paragraph } from './components/Heading';
import { Stagger } from '@animatereactnative/stagger';
import {
FadeInDown,
FadeOutDown,
ZoomInEasyDown,
} from 'react-native-reanimated';
// import { TextInput } from 'react-native-paper';
const primary = true;
export default function App() {
const [show, setShow] = React.useState(false);
return (
<SafeAreaView style={styles.container}>
<StatusBar hidden />
<View
style={{
position: 'absolute',
bottom: 20,
flexDirection: 'row',
justifyContent: 'space-evenly',
zIndex: 99,
}}
>
<Button
title={`Show: ${show.toString()}`}
onPress={() => {
setShow((show) => !show);
}}
/>
</View>
{show && (
<Stagger
stagger={50}
duration={300}
exitDirection={-1}
entering={() => ZoomInEasyDown}
exiting={() => FadeOutDown.springify()}
style={{
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'center',
gap: 12,
}}
>
{[...Array(6).keys()].map((item, index) => {
return (
<Box
key={`item_${item}`}
spacing={0}
size={100}
primary={primary}
>
{(index + 1) % 2 === 0 ? (
<Image
source={{
uri: `https://source.unsplash.com/random/${100 + index}x${
100 + index
}/?landscape`,
}}
style={StyleSheet.absoluteFillObject}
/>
) : (
<Heading primary={!primary}>{index}</Heading>
)}
</Box>
);
})}
</Stagger>
)}
{show && (
<Stagger
stagger={70}
duration={300}
exitDirection={-1}
entering={() => {
return FadeInDown.springify();
}}
style={{ flex: 1, marginTop: 32 }}
>
<Heading>Works with any</Heading>
<Heading>Element</Heading>
<Paragraph>1. Custom duration</Paragraph>
<Paragraph>2. Custom stagger</Paragraph>
<Paragraph>3. Custom animation</Paragraph>
<Paragraph>4. Custom enter/exit direction</Paragraph>
<View style={{ height: 20 }} />
<Paragraph style={{ fontSize: 18 }}>
Powered by Reanimated 3
</Paragraph>
<Paragraph style={{ fontSize: 18 }}>Works with Expo</Paragraph>
<View style={{ height: 40 }} />
<Paragraph>@animatereactnative/stagger</Paragraph>
<View style={{ height: 60 }} />
<Image
source={{
uri: 'https://www.animatereactnative.com/animatereactnative_dark.svg',
}}
style={{ width: '100%', height: 100 }}
contentFit="contain"
/>
</Stagger>
)}
</SafeAreaView>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: !primary ? '#F0F464' : '#1F1F1F',
flex: 1,
justifyContent: 'center',
alignItems: 'center',
padding: 12,
},
box: {
width: 60,
height: 60,
marginVertical: 20,
},
});