MapUI.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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 = ({
  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. { !state.isHide &&
  68. <Maps.Maps3
  69. ready={state.mapReady}
  70. region={state.region}
  71. stopList={state.stopList}
  72. onMapReady={onMapReady}
  73. useApplesMap={useApplesMap}
  74. onMarkerPress={viewChargeStation}
  75. showUserLocation={showUserLocation}
  76. />
  77. }
  78. <BottomSiteInfo
  79. visible={state.showStation}
  80. stationInfo={state.stationInfo}
  81. onFavorite={onFavorite}
  82. onClose={onCloseInfo}
  83. />
  84. </View>
  85. </View>
  86. );
  87. }
  88. const styles = StyleSheet.create({
  89. logoView: {
  90. /*left: 0,
  91. right: 0,
  92. bottom: 0,
  93. zIndex: 1,
  94. alignItems: 'center',
  95. position: 'absolute',*/
  96. flex: 1,
  97. alignItems: 'center',
  98. justifyContent: 'center'
  99. },
  100. navIcon: {
  101. width: 42,
  102. height: 42,
  103. marginLeft: 4,
  104. marginRight: 2,
  105. alignItems: 'center',
  106. flexDirection: 'row',
  107. justifyContent: 'center'
  108. },
  109. searchView: {
  110. ...$padding(8, 16, 16),
  111. backgroundColor: colorThemes
  112. },
  113. searchInput: {
  114. alignItems: 'center',
  115. borderWidth: 1,
  116. borderStyle: 'solid',
  117. borderRadius: 60,
  118. borderColor: colorAccent,
  119. flexDirection: 'row',
  120. paddingLeft: 16,
  121. paddingRight: 16,
  122. backgroundColor: 'rgba(255, 255, 255, 0.5)'
  123. },
  124. searchText: {
  125. flex: 1,
  126. color: '#444',
  127. padding: 8,
  128. fontSize: 15
  129. },
  130. mapContent: {
  131. flex: 1,
  132. zIndex: 4,
  133. position: 'relative',
  134. }
  135. })