MapUI.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /**
  2. * 首页地图定制布局
  3. * @邠心vbe on 2023/09/01
  4. */
  5. import React from 'react';
  6. import { View, Pressable, Image, StyleSheet } from 'react-native';
  7. import Toolbar, { BackButton, Styles } from '../../components/Toolbar';
  8. import { PageList } from '../Router';
  9. import BottomSiteInfo from './maps/BottomSiteInfo';
  10. import Maps from './maps/Maps';
  11. import PinMessage from './maps/PinMessage';
  12. import SearchTool from './maps/SearchTool';
  13. export default MapUI = React.memo(({
  14. state,
  15. navigation,
  16. onFilter,
  17. onMapReady,
  18. onFavorite,
  19. onLocation,
  20. onCloseInfo,
  21. useApplesMap,
  22. showUserLocation,
  23. viewChargeStation,
  24. pinMessages=[]
  25. }) => {
  26. return (
  27. <View style={ui.flex1}>
  28. <Toolbar>
  29. <BackButton
  30. style={styles.navIcon}
  31. onPress={() => {
  32. navigation?.toggleDrawer();
  33. }}>
  34. <EvilIcons
  35. name={'navicon'}
  36. size={28}
  37. color={colorPrimary}
  38. style={{width: 28, height: 28, lineHeight: 28}} />
  39. </BackButton>
  40. <View style={styles.logoView}>
  41. <Image
  42. source={require('../../images/tool-logo.png')}
  43. style={Styles.logo}
  44. resizeMode="contain"
  45. />
  46. </View>
  47. {/* <Text style={ui.flex1}></Text> */}
  48. <BackButton
  49. style={styles.navIcon}
  50. onPress={() => startPage(PageList.scanqr, {actionDetail: true})}>
  51. <MaterialCommunityIcons
  52. name='line-scan'
  53. size={20}
  54. color={colorPrimary}
  55. />
  56. </BackButton>
  57. </Toolbar>
  58. <SearchTool
  59. count={state.stopList?.length}
  60. mapReady={state.mapReady}
  61. onFilter={onFilter}
  62. onLocation={onLocation}
  63. navigation={navigation}
  64. />
  65. <PinMessage messageList={pinMessages}/>
  66. <View style={styles.mapContent}>
  67. <Maps.Maps3
  68. ready={state.mapReady}
  69. region={state.region}
  70. stopList={state.stopList}
  71. onMapReady={onMapReady}
  72. useApplesMap={useApplesMap}
  73. onMarkerPress={viewChargeStation}
  74. showUserLocation={showUserLocation}
  75. />
  76. <BottomSiteInfo
  77. visible={state.showStation}
  78. stationInfo={state.stationInfo}
  79. onFavorite={onFavorite}
  80. onClose={onCloseInfo}
  81. />
  82. </View>
  83. </View>
  84. );
  85. })
  86. const styles = StyleSheet.create({
  87. logoView: {
  88. /*left: 0,
  89. right: 0,
  90. bottom: 0,
  91. zIndex: 1,
  92. alignItems: 'center',
  93. position: 'absolute',*/
  94. flex: 1,
  95. alignItems: 'center',
  96. justifyContent: 'center'
  97. },
  98. navIcon: {
  99. width: 42,
  100. height: 42,
  101. marginLeft: 4,
  102. marginRight: 2,
  103. alignItems: 'center',
  104. flexDirection: 'row',
  105. justifyContent: 'center'
  106. },
  107. searchView: {
  108. ...$padding(8, 16, 16),
  109. backgroundColor: colorThemes
  110. },
  111. searchInput: {
  112. alignItems: 'center',
  113. borderWidth: 1,
  114. borderStyle: 'solid',
  115. borderRadius: 60,
  116. borderColor: colorAccent,
  117. flexDirection: 'row',
  118. paddingLeft: 16,
  119. paddingRight: 16,
  120. backgroundColor: 'rgba(255, 255, 255, 0.5)'
  121. },
  122. searchText: {
  123. flex: 1,
  124. color: '#444',
  125. padding: 8,
  126. fontSize: 15
  127. },
  128. mapContent: {
  129. flex: 1,
  130. zIndex: 4,
  131. position: 'relative',
  132. }
  133. })