Guest User

Untitled

a guest
Jul 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. import React from 'react'
  2. import { TouchableOpacity, StyleSheet, View, Text } from 'react-native'
  3. import Ionicons from 'react-native-vector-icons/Ionicons'
  4.  
  5. const Header = ({
  6. colorLeft,
  7. leftButton,
  8. leftIcon,
  9. title,
  10. colorRight,
  11. rightButton,
  12. rightIcon,
  13. screen,
  14. history,
  15. item
  16. }) => {
  17. return (
  18. <View style={styles.container}>
  19. {leftButton === true &&
  20. <TouchableOpacity onPress={() => history.goBack()}>
  21. <Ionicons name={leftIcon} style={styles.leftButton} color={colorLeft} />
  22. </TouchableOpacity>
  23. }
  24. <Text style={styles.title}>{title}</Text>
  25. {rightButton === true &&
  26. <TouchableOpacity onPress={() => history.push(screen, (item))}>
  27. <Ionicons name={rightIcon} style={styles.rightButton} color={colorRight} />
  28. </TouchableOpacity>
  29. }
  30. </View>
  31. )
  32. }
  33.  
  34. const styles = StyleSheet.create({
  35. container: {
  36. justifyContent: 'center',
  37. alignItems: 'center',
  38. height: 70,
  39. shadowColor: '#000',
  40. shadowOffset: { width: 0, height: 2 },
  41. shadowOpacity: 0.2,
  42. elevation: 2,
  43. backgroundColor: '#fff',
  44. flexDirection: 'row',
  45. position: 'relative'
  46. },
  47. title: {
  48. flex: 1,
  49. color: '#D70086',
  50. paddingTop: 23,
  51. fontFamily: 'AppleSDGothicNeo-Light',
  52. justifyContent: 'center',
  53. alignItems: 'center',
  54. fontWeight: '600',
  55. textAlign: 'center',
  56. fontSize: 18
  57. },
  58. leftAvatar: {
  59. height: 40,
  60. width: 40,
  61. marginTop: 20,
  62. marginLeft: 5
  63. },
  64. leftButton: {
  65. paddingTop: 25,
  66. paddingLeft: 10,
  67. fontSize: 35
  68. },
  69. rightButton: {
  70. paddingTop: 24,
  71. paddingRight: 13,
  72. fontSize: 35
  73. }
  74. })
  75.  
  76. export { Header }
Add Comment
Please, Sign In to add comment