expo-gaode-map 2.2.6-next.1 → 2.2.7-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,11 +18,11 @@ function Marker(props) {
|
|
|
18
18
|
// 根据是否有 children 来决定使用哪个尺寸属性
|
|
19
19
|
const hasChildren = !!children;
|
|
20
20
|
const finalIconWidth = hasChildren
|
|
21
|
-
? (customViewWidth && customViewWidth > 0 ? customViewWidth :
|
|
22
|
-
: (iconWidth && iconWidth > 0 ? iconWidth :
|
|
21
|
+
? (customViewWidth && customViewWidth > 0 ? customViewWidth : 0)
|
|
22
|
+
: (iconWidth && iconWidth > 0 ? iconWidth : 0);
|
|
23
23
|
const finalIconHeight = hasChildren
|
|
24
|
-
? (customViewHeight && customViewHeight > 0 ? customViewHeight :
|
|
25
|
-
: (iconHeight && iconHeight > 0 ? iconHeight :
|
|
24
|
+
? (customViewHeight && customViewHeight > 0 ? customViewHeight : 0)
|
|
25
|
+
: (iconHeight && iconHeight > 0 ? iconHeight : 0);
|
|
26
26
|
return (<NativeMarkerView latitude={position.latitude} longitude={position.longitude} iconWidth={finalIconWidth} iconHeight={finalIconHeight} customViewWidth={finalIconWidth} customViewHeight={finalIconHeight} {...restProps}>
|
|
27
27
|
{children}
|
|
28
28
|
</NativeMarkerView>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marker.js","sourceRoot":"","sources":["../../../src/components/overlays/Marker.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAG7D,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,YAAY,CAAC,CAAC;AAEhE;;;;;;;;;GASG;AACH,SAAS,MAAM,CAAC,KAAkB;IAChC,mCAAmC;IACnC,MAAM,EAAE,QAAQ,EAAE,eAAe,EAAE,gBAAgB,EAAE,SAAS,EAAE,UA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G,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,OAAO,CACL,CAAC,gBAAgB,CACf,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAC5B,SAAS,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC9B,SAAS,CAAC,CAAC,cAAc,CAAC,CAC1B,UAAU,CAAC,CAAC,eAAe,CAAC,CAC5B,eAAe,CAAC,CAAC,cAAc,CAAC,CAChC,gBAAgB,CAAC,CAAC,eAAe,CAAC,CAClC,IAAI,SAAS,CAAC,CAEd;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,gBAAgB,CAAC,CACpB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,SAAS,aAAa,CAAC,SAAsB,EAAE,SAAsB;IACnE,0BAA0B;IAC1B,IACE,SAAS,CAAC,QAAQ,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,CAAC,QAAQ;QAC3D,SAAS,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,QAAQ,CAAC,SAAS,EAC7D,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,0CAA0C;IAC1C,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,6BAA6B;IAC7B,IAAI,SAAS,CAAC,QAAQ,KAAK,SAAS,CAAC,QAAQ,EAAE,CAAC;QAC9C,OAAO,KAAK,CAAC;IACf,CAAC;IAED,eAAe;IACf,OAAO,IAAI,CAAC;AACd,CAAC;AAED,WAAW;AACX,eAAe,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC","sourcesContent":["import * as React from 'react';\nimport { requireNativeViewManager } from 'expo-modules-core';\nimport type { MarkerProps } from '../../types';\n\nconst NativeMarkerView = requireNativeViewManager('MarkerView');\n\n/**\n * Marker 组件 - 完全声明式 API\n *\n * 支持:\n * - 自定义图标(icon)\n * - 自定义内容(children)\n * - 大头针样式(pinColor)\n * - 拖拽功能\n * - 所有事件回调\n */\nfunction Marker(props: MarkerProps) {\n // 从 props 中排除 position 属性,避免传递到原生层\n const { position, customViewWidth, customViewHeight, iconWidth, iconHeight, children, ...restProps } = props;\n \n // 🔑 性能优化:使用常量避免重复计算\n // 根据是否有 children 来决定使用哪个尺寸属性\n const hasChildren = !!children;\n const finalIconWidth = hasChildren\n ? (customViewWidth && customViewWidth > 0 ? customViewWidth : 0)\n : (iconWidth && iconWidth > 0 ? iconWidth : 0);\n const finalIconHeight = hasChildren\n ? (customViewHeight && customViewHeight > 0 ? customViewHeight : 0)\n : (iconHeight && iconHeight > 0 ? iconHeight : 0);\n \n return (\n <NativeMarkerView\n latitude={position.latitude}\n longitude={position.longitude}\n iconWidth={finalIconWidth}\n iconHeight={finalIconHeight}\n customViewWidth={finalIconWidth}\n customViewHeight={finalIconHeight}\n {...restProps}\n >\n {children}\n </NativeMarkerView>\n );\n}\n\n/**\n * 🔑 性能优化:极简比较函数\n * 只检查最常变化的关键属性,减少 JS 线程开销\n */\nfunction arePropsEqual(prevProps: MarkerProps, nextProps: MarkerProps): boolean {\n // 快速路径:比较 position (最常变化)\n if (\n prevProps.position.latitude !== nextProps.position.latitude ||\n prevProps.position.longitude !== nextProps.position.longitude\n ) {\n return false;\n }\n \n // 比较 cacheKey (如果提供了 cacheKey,其他属性理论上不会变)\n if (prevProps.cacheKey !== nextProps.cacheKey) {\n return false;\n }\n \n // 比较 children (如果有 children)\n if (prevProps.children !== nextProps.children) {\n return false;\n }\n \n // 其他属性相同,不重新渲染\n return true;\n}\n\n// 导出优化后的组件\nexport default React.memo(Marker, arePropsEqual);"]}
|