-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGroupApp.js
More file actions
196 lines (181 loc) · 4.95 KB
/
GroupApp.js
File metadata and controls
196 lines (181 loc) · 4.95 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
import React, {useState, useEffect} from 'react';
import {
Animated,
Dimensions,
ScrollView,
StyleSheet,
Text,
View,
} from 'react-native';
import Splash from './views/screens/splash';
import Login from './views/screens/Login';
import Group from './views/screens/Group';
import Member from './views/screens/Member';
import Youtube from './views/screens/Youtube';
import Resume from './views/screens/Resume';
import Portfolio from './views/screens/Portfolio/Portfolio';
import Review from './views/screens/Review/Review';
import Album from './views/screens/Album';
import Interview from './views/screens/Interview';
import 'react-native-gesture-handler';
import WhichGroup from './views/screens/WhichGroup';
import Help from './views/screens/Help';
import Share from './views/screens/Share';
import MyPage from './views/screens/MyPage';
import GroupVideo from './views/screens/GroupVideo';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import AsyncStorage from '@react-native-async-storage/async-storage';
const SCREEN_WIDTH = Dimensions.get('window').width;
const xOffset = new Animated.Value(0);
const Screen = props => {
return (
<View style={styles.scrollPage}>
<Animated.View style={[styles.screen, transitionAnimation(props.index)]}>
{props.children}
</Animated.View>
</View>
);
};
const Stack = createStackNavigator();
const transitionAnimation = index => {
return {
transform: [
{perspective: 800},
{
scale: xOffset.interpolate({
inputRange: [
(index - 1) * SCREEN_WIDTH,
index * SCREEN_WIDTH,
(index + 1) * SCREEN_WIDTH,
],
outputRange: [0.95, 1, 0.95],
}),
},
{
rotateX: xOffset.interpolate({
inputRange: [
(index - 1) * SCREEN_WIDTH,
index * SCREEN_WIDTH,
(index + 1) * SCREEN_WIDTH,
],
outputRange: ['0deg', '0deg', '0deg'], //x각도
}),
},
{
rotateY: xOffset.interpolate({
inputRange: [
(index - 1) * SCREEN_WIDTH,
index * SCREEN_WIDTH,
(index + 1) * SCREEN_WIDTH,
],
outputRange: ['35deg', '0deg', '-35deg'], //y각도
}),
},
],
};
};
const GroupApp = () => {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen
name="Home"
component={HomeScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="Help"
component={Help}
options={{headerShown: false}}
/>
<Stack.Screen
name="Share"
component={Share}
options={{headerShown: false}}
/>
<Stack.Screen
name="Album"
component={Album}
options={{headerShown: false}}
/>
</Stack.Navigator>
</NavigationContainer>
);
};
const HomeScreen = () => {
const [modalOpen, setModalOpen] = useState(false);
const [isSplashVisible, setIsSplashVisible] = useState(true);
useEffect(() => {
AsyncStorage.getItem('isSplashVisible').then(value => {
if (value !== null) {
setIsSplashVisible(JSON.parse(value));
}
});
let timer = setTimeout(() => {
setIsSplashVisible(false);
console.log('Splash:' + isSplashVisible);
}, 2000);
return () => clearTimeout(timer);
}, []);
useEffect(() => {
AsyncStorage.setItem('isSplashVisible', JSON.stringify(isSplashVisible));
}, [isSplashVisible]);
return (
<Animated.ScrollView
scrollEventThrottle={16}
onScroll={Animated.event([{nativeEvent: {contentOffset: {x: xOffset}}}], {
useNativeDriver: true,
})}
horizontal
pagingEnabled
style={styles.scrollView}>
{/* <Splash isSplashVisible={isSplashVisible} />
{isSplashVisible === false ? ( */}
<Screen text="Screen 1" index={0}>
<WhichGroup />
</Screen>
{/* ) : null} */}
<Screen text="Screen 2" index={1}>
<GroupVideo />
</Screen>
<Screen text="Screen 3" index={2}>
<Interview />
</Screen>
<Screen text="Screen 4" index={3}>
<Portfolio options={{headerShown: false}} />
</Screen>
<Screen text="Screen 5" index={4}>
<Resume modalOpen={modalOpen} />
</Screen>
<Screen text="Screen 6" index={5}>
<Review />
</Screen>
<Screen text="Screen 7" index={6}>
<MyPage />
</Screen>
</Animated.ScrollView>
);
};
const styles = StyleSheet.create({
scrollView: {
flexDirection: 'row',
backgroundColor: 'black',
},
scrollPage: {
width: SCREEN_WIDTH,
},
screen: {
width: '100%',
height: '100%',
justifyContent: 'center',
alignItems: 'center',
borderRadius: 0,
backgroundColor: 'white',
},
text: {
fontSize: 45,
fontWeight: 'bold',
},
});
export default GroupApp;