-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathListHeaderView.js
64 lines (58 loc) · 1.66 KB
/
ListHeaderView.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
import React, { Button } from 'react';
import styled from 'styled-components/native';
const ListHeaderView = styled.View`
background-color: ${props =>
props.background ? props.background : 'green'};
align-items: center;
display: flex;
border-style: solid;
border-bottom-width: ${props => (props.border !== false ? 1 : 0)}px;
border-bottom-color: rgba(255, 255, 255, 0.1);
padding-right: 10px;
padding-left: 10px;
padding-bottom: 3px;
justify-content: space-between;
flex-direction: row;
`;
const ListHeaderText = styled.Text`
color: ${props => 'white'};
opacity: 0.7;
`;
const ListHeaderButton = styled(Button)`
color: gray;
position: relative;
z-index: 99;
`;
export class ListHeader extends React.Component {
state = {
editing: false
};
constructor(props) {
super(props);
}
render() {
return (
<ListHeaderView
pointerEvents="box-none"
background={this.props.background}
border={this.props.border}
// // padding={this.props.padding}
// paddingTop={this.props.paddingTop}
// paddingBottom={this.props.paddingBottom}
style={this.props.style}>
<ListHeaderText>{this.props.children}</ListHeaderText>
{this.props.editButton ? (
<ListHeaderButton
hitSlop={{ top: 15, left: 30, bottom: 15, right: 30 }}
active={this.state.editing}
onPress={() => {
this.setState({ editing: !this.state.editing ? true : false });
this.props.onEditPress ? this.props.onEditPress() : null;
}}>
Edit
</ListHeaderButton>
) : null}
</ListHeaderView>
);
}
}