-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
105 lines (100 loc) · 2.37 KB
/
App.js
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
import React, { Fragment } from 'react';
import {
StyleSheet,
Text,
View,
TextInput,
SafeAreaView,
ImageBackground,
ScrollView,
StatusBar,
Animated,
Image,
TouchableOpacity,
Dimensions,
} from 'react-native';
import { BlurView, LinearGradient } from 'expo';
import Header from './Header';
const { width: windowWidth } = Dimensions.get('window');
const HEIGHT = 280;
export default class App extends React.Component {
state = { scrollValue: new Animated.Value(0) };
render() {
return (
<View style={{ flex: 1 }}>
<StatusBar animated barStyle={'dark-content'} />
<Header animatedVal={this.state.scrollValue} />
<Animated.ScrollView
contentContainerStyle={{ paddingTop: HEIGHT }}
scrollEventThrottle={16}
onScroll={Animated.event([
{ nativeEvent: { contentOffset: { y: this.state.scrollValue } } },
])}
>
<Row title="Explore" />
<Row title="Explore" />
<Row title="Explore" />
<Row title="Explore" />
<Row title="Explore" />
<Row title="Explore" />
<Row title="Explore" />
</Animated.ScrollView>
</View>
);
}
}
const Row = ({ title }) => (
<View>
<Text
style={{
paddingTop: 16,
paddingHorizontal: 16,
fontWeight: 'bold',
fontSize: 18,
}}
>
{title}
</Text>
<ScrollView
contentContainerStyle={{ padding: 12 }}
pagingEnabled
horizontal
showsHorizontalScrollIndicator={false}
>
<Card imageSrc={require('./pic2.jpg')} title="Just Add type" />
<Card imageSrc={require('./pic3.jpg')} title="Sky" />
</ScrollView>
</View>
);
const Card = ({ title, imageSrc }) => (
<TouchableOpacity>
<ImageBackground
source={imageSrc}
style={{
width: windowWidth - 30,
height: 120,
borderRadius: 12,
overflow: 'hidden',
justifyContent: 'center',
alignItems: 'center',
marginRight: 10,
}}
>
<View
style={{
...StyleSheet.absoluteFillObject,
backgroundColor: 'rgba(0,0,0,0.2)',
}}
/>
<Text
style={{
fontWeight: 'bold',
fontSize: 18,
color: 'white',
}}
>
{title}
</Text>
</ImageBackground>
</TouchableOpacity>
);