Application Android et IOS pour l'amicale des élèves
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CustomHeader.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import React from "react";
  2. import {Body, Button, Header, Icon, Left, Right, Title} from "native-base";
  3. import {StyleSheet} from "react-native";
  4. import {getStatusBarHeight} from "react-native-status-bar-height";
  5. import Touchable from 'react-native-platform-touchable';
  6. export default class CustomHeader extends React.Component {
  7. render() {
  8. let button;
  9. let rightMenu;
  10. if (this.props.backButton !== undefined && this.props.backButton === true)
  11. button =
  12. <Touchable
  13. style={{padding: 6}}
  14. onPress={() => this.props.navigation.goBack()}>
  15. <Icon
  16. style={{color: "#fff"}}
  17. name="arrow-left"
  18. type={'MaterialCommunityIcons'}/>
  19. </Touchable>;
  20. else
  21. button =
  22. <Touchable
  23. style={{padding: 6}}
  24. onPress={() => this.props.navigation.toggleDrawer()}>
  25. <Icon
  26. style={{color: "#fff"}}
  27. name="menu"
  28. type={'MaterialCommunityIcons'}/>
  29. </Touchable>;
  30. if (this.props.rightMenu)
  31. rightMenu = this.props.rightMenu;
  32. else
  33. rightMenu = <Right/>;
  34. return (
  35. <Header style={styles.header}>
  36. <Left>
  37. {button}
  38. </Left>
  39. <Body>
  40. <Title>{this.props.title}</Title>
  41. </Body>
  42. {rightMenu}
  43. </Header>);
  44. }
  45. };
  46. // Fix header in status bar on Android
  47. const styles = StyleSheet.create({
  48. header: {
  49. paddingTop: getStatusBarHeight(),
  50. height: 54 + getStatusBarHeight(),
  51. },
  52. });