-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathToolbarTitle.js
50 lines (43 loc) · 1.08 KB
/
ToolbarTitle.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
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { View, Text, TouchableWithoutFeedback, StyleSheet, Platform } from 'react-native';
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
},
});
export default class ToolbarTitle extends Component {
static defaultProps: Object = {
title: '',
color: '#fff',
size: 18,
onTouch: () => {},
};
static propTypes: Object = {
title: PropTypes.string,
color: PropTypes.string,
size: PropTypes.number,
onTouch: PropTypes.func,
style: PropTypes.object,
};
_handleTouch = () => {
this.props.onTouch();
};
render() {
const { title, color, size, style } = this.props;
return (
<TouchableWithoutFeedback onPress={this._handleTouch}>
<View style={styles.container}>
<Text
style={[{
color,
fontSize: size,
marginLeft: 5,
}, style]}>{title}</Text>
</View>
</TouchableWithoutFeedback>
);
}
}