-
Notifications
You must be signed in to change notification settings - Fork 0
/
AndroidFloatSectionHeader.js
42 lines (36 loc) · 942 Bytes
/
AndroidFloatSectionHeader.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
import React, {
PropTypes,
Component,
} from 'react'
import {
View,
} from 'react-native'
export default class AndroidFloatSectionHeader extends Component {
static propTypes = {
...View.propTypes,
floatSectionHeaderWidth: PropTypes.number.isRequired,
renderChildren: PropTypes.func.isRequired,
}
constructor (props) {
super(props)
this.state = {
sectionID: '',
hidden: true,
}
}
render () {
return (
<View
{...this.props}
style={{position: 'absolute', top: 0, left: 0, width: this.props.floatSectionHeaderWidth,
opacity: !this.state.hidden ? 1 : 0, }}>
{this.props.renderChildren(this.state.sectionID)}
</View>
)
}
setSectionID = (sectionID) => {
this.setState({
sectionID,
})
}
}