Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add style props for map #64

Merged
merged 2 commits into from
Dec 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading