-
-
Notifications
You must be signed in to change notification settings - Fork 65
/
Copy pathHeaderButton.js
37 lines (33 loc) · 886 Bytes
/
HeaderButton.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
/**
* @flow
*/
import * as React from 'react';
const BUTTON_HIT_SLOP = { top: 5, bottom: 5, left: 5, right: 5 };
import { StyleSheet, View } from 'react-native';
import Touchable from 'react-native-platform-touchable';
type Props = {
onPress: () => void,
ButtonElement: React.Node,
buttonWrapperStyle?: Object,
};
export class HeaderButton extends React.PureComponent<Props> {
render() {
const { ButtonElement, onPress, buttonWrapperStyle } = this.props;
return (
<Touchable
background={Touchable.SelectableBackgroundBorderless()}
onPress={onPress}
hitSlop={BUTTON_HIT_SLOP}
style={[styles.buttonContainer, buttonWrapperStyle]}
>
<View>{ButtonElement}</View>
</Touchable>
);
}
}
const styles = StyleSheet.create({
buttonContainer: {
alignItems: 'center',
justifyContent: 'center',
},
});