From 2195181fa35fba76742d7d7bb203cb3375b757f3 Mon Sep 17 00:00:00 2001 From: joeriddles Date: Thu, 9 Oct 2025 17:55:22 -0600 Subject: [PATCH 1/2] Allow overriding child container style in non-legacy Map components --- modules/react-mapbox/src/components/map.tsx | 5 ++++- modules/react-maplibre/src/components/map.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/react-mapbox/src/components/map.tsx b/modules/react-mapbox/src/components/map.tsx index fbd52b399..f8dc5bc99 100644 --- a/modules/react-mapbox/src/components/map.tsx +++ b/modules/react-mapbox/src/components/map.tsx @@ -31,6 +31,8 @@ export type MapProps = MapInitOptions & id?: string; /** Map container CSS style */ style?: CSSProperties; + /** Map child container CSS style */ + childContainerStyle?: CSSProperties; children?: any; }; @@ -117,7 +119,8 @@ function _Map(props: MapProps, ref: React.Ref) { ); const CHILD_CONTAINER_STYLE = { - height: '100%' + height: '100%', + ...props.childContainerStyle }; return ( diff --git a/modules/react-maplibre/src/components/map.tsx b/modules/react-maplibre/src/components/map.tsx index 1300d1200..2c4e6a311 100644 --- a/modules/react-maplibre/src/components/map.tsx +++ b/modules/react-maplibre/src/components/map.tsx @@ -31,6 +31,8 @@ export type MapProps = MapInitOptions & id?: string; /** Map container CSS style */ style?: CSSProperties; + /** Map child container CSS style */ + childContainerStyle?: CSSProperties; children?: any; }; @@ -118,7 +120,8 @@ function _Map(props: MapProps, ref: React.Ref) { ); const CHILD_CONTAINER_STYLE = { - height: '100%' + height: '100%', + ...props.childContainerStyle }; return ( From bf71e41ffa22b23a2949c707ea1fce3337520e77 Mon Sep 17 00:00:00 2001 From: joeriddles Date: Thu, 9 Oct 2025 17:57:36 -0600 Subject: [PATCH 2/2] Only render map child container if props.children is truthy --- modules/react-mapbox/src/components/map.tsx | 2 +- modules/react-maplibre/src/components/map.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/react-mapbox/src/components/map.tsx b/modules/react-mapbox/src/components/map.tsx index f8dc5bc99..e65f9a76e 100644 --- a/modules/react-mapbox/src/components/map.tsx +++ b/modules/react-mapbox/src/components/map.tsx @@ -125,7 +125,7 @@ function _Map(props: MapProps, ref: React.Ref) { return (
- {mapInstance && ( + {mapInstance && props.children && (
{props.children} diff --git a/modules/react-maplibre/src/components/map.tsx b/modules/react-maplibre/src/components/map.tsx index 2c4e6a311..a3eae67e1 100644 --- a/modules/react-maplibre/src/components/map.tsx +++ b/modules/react-maplibre/src/components/map.tsx @@ -126,7 +126,7 @@ function _Map(props: MapProps, ref: React.Ref) { return (
- {mapInstance && ( + {mapInstance && props.children && (
{props.children}