ToolbarUgly.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. scope,
  7. showBack=true,
  8. rightIcon,
  9. onBackPress
  10. }) => (
  11. <View style={styles.toolbarUgly}>
  12. { showBack &&
  13. <TouchableOpacity
  14. style={styles.uglyIcon}
  15. onPress={() => {
  16. if (onBackPress) {
  17. onBackPress();
  18. } else {
  19. goBack();
  20. }
  21. }}>
  22. <MaterialIcons
  23. name={'arrow-back-ios'}
  24. size={20}
  25. color={textPrimary} />
  26. </TouchableOpacity>
  27. }
  28. <TextView style={styles.titleText}>{scope ? $t(scope) : title}</TextView>
  29. { rightIcon
  30. ? rightIcon()
  31. : showBack
  32. ? <View style={styles.uglyIcon}>
  33. <MaterialIcons
  34. name={'arrow-back-ios'}
  35. size={16}
  36. color={'transparent'} />
  37. </View>
  38. : <></>
  39. }
  40. </View>
  41. )
  42. const styles = StyleSheet.create({
  43. toolbarUgly: {
  44. paddingTop: statusHeight,
  45. alignItems: 'center',
  46. flexDirection: 'row',
  47. backgroundColor: colorLight
  48. },
  49. uglyIcon: {
  50. height: 40,
  51. paddingLeft: 16,
  52. paddingRight: 8,
  53. alignItems: 'center',
  54. justifyContent: 'center'
  55. },
  56. titleText: {
  57. flex: 1,
  58. color: textPrimary,
  59. padding: 0,
  60. fontSize: 20,
  61. fontWeight: 'bold',
  62. textAlign: 'left',
  63. //textTransform: 'uppercase'
  64. }
  65. })