MapUI.js 3.2 KB

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