forked from Kureev/react-native-side-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenu.js
75 lines (69 loc) · 1.37 KB
/
Menu.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
import React from 'react';
import PropTypes from 'prop-types';
import {
Dimensions,
StyleSheet,
ScrollView,
View,
Image,
Text,
} from 'react-native';
const window = Dimensions.get('window');
const uri = 'https://pickaface.net/gallery/avatar/Opi51c74d0125fd4.png';
const styles = StyleSheet.create({
menu: {
flex: 1,
width: window.width,
height: window.height,
backgroundColor: 'gray',
padding: 20,
},
avatarContainer: {
marginBottom: 20,
marginTop: 20,
},
avatar: {
width: 48,
height: 48,
borderRadius: 24,
flex: 1,
},
name: {
position: 'absolute',
left: 70,
top: 20,
},
item: {
fontSize: 14,
fontWeight: '300',
paddingTop: 5,
},
});
export default function Menu({ onItemSelected }) {
return (
<ScrollView scrollsToTop={false} style={styles.menu}>
<View style={styles.avatarContainer}>
<Image
style={styles.avatar}
source={{ uri }}
/>
<Text style={styles.name}>Your name</Text>
</View>
<Text
onPress={() => onItemSelected('About')}
style={styles.item}
>
About
</Text>
<Text
onPress={() => onItemSelected('Contacts')}
style={styles.item}
>
Contacts
</Text>
</ScrollView>
);
}
Menu.propTypes = {
onItemSelected: PropTypes.func.isRequired,
};