ToolbarUgly.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. alignItems: 'center',
  45. flexDirection: 'row',
  46. backgroundColor: colorLight
  47. },
  48. uglyIcon: {
  49. height: 40,
  50. paddingLeft: 16,
  51. paddingRight: 8,
  52. alignItems: 'center',
  53. justifyContent: 'center'
  54. },
  55. titleText: {
  56. flex: 1,
  57. color: textPrimary,
  58. padding: 0,
  59. fontSize: 20,
  60. fontWeight: 'bold',
  61. textAlign: 'left',
  62. //textTransform: 'uppercase'
  63. }
  64. })