Skip to content

Commit

Permalink
fix: add style props for map (#64)
Browse files Browse the repository at this point in the history
* fix: add style props for map

* chore: chngeset
  • Loading branch information
lvisei authored Dec 25, 2024
1 parent fce8197 commit 5bea040
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-dingos-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@antv/gpt-vis': patch
---

fix: add style props for map
6 changes: 3 additions & 3 deletions src/Map/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { LarkMap } from '@antv/larkmap';
import React, { useMemo, type FC } from 'react';
import type { BaseMapProps } from '../types';
import { formatMapStyle } from '../utils/map';
import { MapView, Marker, Polyline } from './Component/';
import { MapView, Marker, Polyline } from './Component';

export type MapProps = Omit<BaseMapProps<any>, 'data'>;

const Map: FC<MapProps> = (props) => {
const { className, containerStyle, children } = props;
const { className, containerStyle, style, children } = props;
const mapConfig = useMemo(() => formatMapStyle(props), [props]);
const onSceneLoaded = async () => {
if (props.onInitComplete) {
Expand All @@ -18,7 +18,7 @@ const Map: FC<MapProps> = (props) => {
return (
<LarkMap
className={className}
style={{ height: 300, ...containerStyle }}
style={{ height: 300, ...containerStyle, ...style }}
{...mapConfig}
onSceneLoaded={onSceneLoaded}
>
Expand Down
1 change: 1 addition & 0 deletions src/types/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export interface BasePlotProps<T> extends BaseChartProps {
}

export interface BaseMapProps<T> extends BaseChartProps, Map {
style?: CSSProperties;
data: T[];
// 高德地图密钥
token?: string;
Expand Down

0 comments on commit 5bea040

Please sign in to comment.