forked from catalinmiron/react-native-dating-app
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomeScreen.js
116 lines (109 loc) · 3.11 KB
/
HomeScreen.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
106
107
108
109
110
111
112
113
114
115
116
import React, { Component } from 'react';
import { Components } from 'expo';
import {
LayoutAnimation,
ScrollView,
Animated,
TouchableOpacity,
Alert,
Image,
Dimensions,
Text,
View,
StyleSheet,
StatusBar
} from 'react-native';
import { withNavigation } from '@expo/ex-navigation';
import styles, { BAR_HEIGHT } from './components/styles.js';
import Slider from './components/Slider';
const { Svg } = Components;
const { Stop, Defs, LinearGradient, G, Use, Circle, Ellipse } = Components.Svg;
import { Ionicons } from '@expo/vector-icons';
var { height, width } = Dimensions.get('window');
@withNavigation
export default class HomeScreen extends Component {
static route = {
navigationBar: {
title: 'Girls nearby',
subtitle: '23/208'
}
};
componentDidMount() {
LayoutAnimation.spring();
}
render() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Slider />
<View
style={{
flex: 0.35,
alignItems: 'center',
justifyContent: 'center'
}}>
<View
style={{
flexDirection: 'row',
alignItems: 'flex-start',
justifyContent: 'space-between',
width: width - 40
}}>
<AButton size={65} color={'#D834FF'} icon={'share-alt'} />
<AButton size={90} color={'#FF00FF'} icon={'star'} />
<AButton size={90} color={'#FF00EC'} icon={'happy'} />
<AButton size={65} color={'#FF50B0'} icon={'sad'} />
</View>
</View>
</View>
);
}
}
class AButton extends Component {
render() {
const stroke = 3;
return (
<TouchableOpacity
onPress={() => Alert.alert(`${this.props.icon} pressed`)}
style={{
width: this.props.size,
height: this.props.size,
alignItems: 'center',
justifyContent: 'center'
}}>
<Svg
height={this.props.size}
width={this.props.size}
style={{
shadowColor: this.props.color,
shadowRadius: 10,
shadowOffset: { width: 0, height: 4 },
shadowOpacity: 0.29,
alignItems: 'center',
justifyContent: 'center',
flex: 1
}}>
<Defs>
<LinearGradient id="buttonGrad" x1="0%" y1="0%" x2="10%" y2="100%">
<Stop offset="0" stopColor={this.props.color} stopOpacity=".5" />
<Stop offset="1" stopColor={this.props.color} stopOpacity="1" />
</LinearGradient>
</Defs>
<Circle
cx={this.props.size / 2}
cy={this.props.size / 2}
r={this.props.size / 2 - stroke * 2}
stroke="url(#buttonGrad)"
strokeWidth={stroke}
fill="#fff"
/>
</Svg>
<Ionicons
name={`md-${this.props.icon}`}
size={this.props.size * 0.45}
style={{ backgroundColor: 'transparent', position: 'absolute' }}
color={this.props.color}
/>
</TouchableOpacity>
);
}
}