-
Notifications
You must be signed in to change notification settings - Fork 427
/
Copy pathCustomBackButton.js
49 lines (41 loc) · 1.12 KB
/
CustomBackButton.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
/**
* Created by guoshuyu on 2017/11/10.
*/
import React, {Component} from 'react';
import {
View, Text, TouchableOpacity
} from 'react-native';
import PropTypes from 'prop-types';
import {Router, Actions, Scene} from 'react-native-router-flux';
import styles from "../../style"
import I18n from '../../style/i18n'
import * as Constant from '../../style/constant'
import Icon from 'react-native-vector-icons/Ionicons'
/**
* 自定义返回按键
*/
class BackButton extends Component {
componentDidMount() {
}
componentWillUnmount() {
}
render() {
if (this.props.hideBackButton) {
return <View/>;
}
return (
<TouchableOpacity style={[styles.centered, {marginHorizontal: 2 * Constant.normalMarginEdge, marginTop:5}]} onPress={() => {
Actions.pop();
}}>
<Icon name={'md-arrow-round-back'} size={20} color={Constant.miWhite}/>
</TouchableOpacity>
)
}
}
BackButton.propTypes = {
hideBackButton: PropTypes.bool
};
BackButton.defaultProps = {
hideBackButton: false
};
export default BackButton