ToolbarUgly.js 1.3 KB

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