Toolbar.js 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. import React from 'react';
  2. import { Image, Pressable, StyleSheet, View } from 'react-native';
  3. import TopChargeBackground from '../icons/TopChargeBackground';
  4. export const BackButton = ({color=pageTitleTint}) => {
  5. return (
  6. <Pressable
  7. style={({pressed }) => [
  8. (pressed && isIOS) && {
  9. opacity: 0.5
  10. },
  11. Styles.backIcon
  12. ]}
  13. android_ripple = {rippleLessIcon}
  14. onPress={() => {
  15. goBack();
  16. }}>
  17. <BackIcon color={color}/>
  18. </Pressable>
  19. )
  20. }
  21. export const BackIcon = ({color=pageTitleTint}) => {
  22. return <MaterialIcons name={isIOS ? 'arrow-back-ios' : 'arrow-back'} size={24} color={color} />
  23. }
  24. export const StationBack = ({bottom = 24, scale=1.0}) => {
  25. return (
  26. // <Image
  27. // style={{
  28. // right: 0,
  29. // bottom: bottom,
  30. // width: 125.8,
  31. // height: 137.64,
  32. // position: 'absolute'
  33. // }}
  34. // source={require('../images/charge/bg-top-station.png')}/>
  35. <View
  36. style={{
  37. right: 0,
  38. bottom: bottom,
  39. width: 127.5 * scale,
  40. height: 136.67 * scale,
  41. position: 'absolute',
  42. alignItems: 'flex-end'
  43. }}>
  44. <TopChargeBackground width={127.5 * scale} height={136.67 * scale}/>
  45. </View>
  46. );
  47. }
  48. export const Styles = StyleSheet.create({
  49. toolbar: {
  50. height: toolbarSize,
  51. paddingLeft: 2,
  52. paddingRight: 2,
  53. paddingTop: isIOS ? statusHeight : 0,
  54. alignItems: 'center',
  55. flexDirection: 'row',
  56. justifyContent: 'center',
  57. backgroundColor: colorThemes
  58. },
  59. backIcon: {
  60. width: 48,
  61. height: 48,
  62. zIndex: 2,
  63. alignItems: 'center',
  64. justifyContent: 'center'
  65. },
  66. content: {
  67. flex: 1,
  68. paddingRight: 48,
  69. alignItems: 'center'
  70. },
  71. logo: {
  72. width:123.8,
  73. height: 38.95
  74. },
  75. rightIcon: {
  76. width: 22,
  77. height: 22,
  78. opacity: 0.9
  79. },
  80. iconOpacity: {
  81. opacity: 0.9
  82. }
  83. });
  84. export default Toolbar = (props) => {
  85. return (
  86. <View style={Styles.toolbar}>
  87. <BackButton/>
  88. <View style={Styles.content}>
  89. <Image
  90. source={require('../images/tool-logo.png')}
  91. style={Styles.logo}
  92. resizeMode="contain"
  93. />
  94. </View>
  95. </View>
  96. )
  97. }