-
Notifications
You must be signed in to change notification settings - Fork 114
/
SimpleView.js
117 lines (108 loc) · 2.61 KB
/
SimpleView.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
117
import React, { Component, } from 'react'
import PropTypes from 'prop-types'
import {
Text,
View,
StatusBar,
Dimensions,
StyleSheet,
} from 'react-native'
import Icon from 'react-native-vector-icons/Ionicons'
import {
BottomSheetBehavior,
CoordinatorLayout,
FloatingActionButton,
} from 'react-native-bottom-sheet-behavior'
const { width } = Dimensions.get('window')
class SimpleView extends Component {
static contextTypes = {
openDrawer: PropTypes.func,
};
handleSlide(e) {
this.offset = e.nativeEvent.offset
}
handleBottomSheetChange(e) {
this.lastState = e.nativeEvent.state
}
render() {
return (
<CoordinatorLayout style={styles.container}>
<StatusBar translucent backgroundColor='#205cb2' />
<View style={styles.content}>
<View style={styles.toolbarWrapper}>
<Icon.ToolbarAndroid
navIconName={'md-menu'}
style={styles.toolbar}
titleColor="white"
title="Simple Bottom Sheet"
onIconClicked={() => this.context.openDrawer()}
/>
</View>
</View>
<BottomSheetBehavior
peekHeight={80}
hideable={false}
onSlide={this.handleSlide}
onStateChange={this.handleBottomSheetChange}>
<View style={styles.bottomSheet}>
<View style={styles.bottomSheetHeader}>
<Text style={styles.label}>BottomSheetBehavior !</Text>
</View>
<View style={styles.bottomSheetContent}>
</View>
</View>
</BottomSheetBehavior>
<FloatingActionButton
autoAnchor
elevation={18}
icon='md-navigate'
iconColor='#4589f2'
iconProvider={Icon}
backgroundColor={'#ffffff'}
rippleColor={'#55ffffff'}
/>
</CoordinatorLayout>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
content: {
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#fff',
},
toolbarWrapper: {
paddingTop: 24,
marginBottom: 24,
backgroundColor: '#4389f2',
},
toolbar: {
width,
height: 56,
},
bottomSheet: {
backgroundColor: '#4389f2',
},
bottomSheetHeader: {
padding: 28,
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'space-between',
},
bottomSheetContent: {
height: 200,
padding: 2,
alignItems: 'center',
backgroundColor: '#fff',
},
label: {
fontSize: 18,
fontWeight: 'bold',
color: '#fff',
},
})
export default SimpleView