ToolbarUgly.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import React from 'react';
  2. import { StyleSheet, TouchableOpacity, View } from 'react-native';
  3. import TextView from './TextView';
  4. export default ToolbarUgly = ({
  5. title,
  6. showBack=true,
  7. onBackPress
  8. }) => (
  9. <View style={styles.toolbarUgly}>
  10. { showBack &&
  11. <TouchableOpacity
  12. style={styles.uglyIcon}
  13. onPress={() => {
  14. if (onBackPress) {
  15. onBackPress();
  16. } else {
  17. goBack();
  18. }
  19. }}>
  20. <MaterialIcons
  21. name={'arrow-back-ios'}
  22. size={20}
  23. color={textPrimary} />
  24. </TouchableOpacity>
  25. }
  26. <TextView style={styles.titleText}>{title}</TextView>
  27. { showBack &&
  28. <View style={styles.uglyIcon}>
  29. <MaterialIcons
  30. name={'arrow-back-ios'}
  31. size={16}
  32. color={'transparent'} />
  33. </View>
  34. }
  35. </View>
  36. )
  37. const styles = StyleSheet.create({
  38. toolbarUgly: {
  39. alignItems: 'center',
  40. flexDirection: 'row',
  41. backgroundColor: colorLight
  42. },
  43. uglyIcon: {
  44. height: 44,
  45. paddingLeft: 16,
  46. paddingRight: 16,
  47. alignItems: 'center',
  48. justifyContent: 'center'
  49. },
  50. titleText: {
  51. flex: 1,
  52. color: textPrimary,
  53. padding: 8,
  54. fontSize: 20,
  55. fontWeight: 'bold',
  56. textAlign: 'center',
  57. textTransform: 'uppercase'
  58. }
  59. })