@@ -4,7 +4,7 @@ import { BackgroundColorContext } from "comps/utils/backgroundColorContext";
4
4
import _ from "lodash" ;
5
5
import { ConstructorToView , deferAction } from "lowcoder-core" ;
6
6
import { HintPlaceHolder , ScrollBar , pageItemRender } from "lowcoder-design" ;
7
- import { RefObject , useContext , createContext , useMemo , useRef } from "react" ;
7
+ import { RefObject , useContext , createContext , useMemo , useRef , useEffect } from "react" ;
8
8
import ReactResizeDetector from "react-resize-detector" ;
9
9
import styled from "styled-components" ;
10
10
import { checkIsMobile } from "util/commonUtils" ;
@@ -19,6 +19,10 @@ import { ContextContainerComp } from "./contextContainerComp";
19
19
import { ListViewImplComp } from "./listViewComp" ;
20
20
import { getCurrentItemParams , getData } from "./listViewUtils" ;
21
21
import { AnimationStyleType } from "@lowcoder-ee/index.sdk" ;
22
+ import { CompTypeContext } from "@lowcoder-ee/comps/utils/compTypeContext" ;
23
+ import { ThemeContext } from "@lowcoder-ee/comps/utils/themeContext" ;
24
+ import { setInitialCompStyles } from "@lowcoder-ee/comps/utils/themeUtil" ;
25
+ import { childrenToProps } from "@lowcoder-ee/comps/generators/multi" ;
22
26
23
27
const ListViewWrapper = styled . div < { $style : any ; $paddingWidth : string , $animationStyle :AnimationStyleType } > `
24
28
height: 100%;
@@ -274,6 +278,25 @@ export function ListView(props: Props) {
274
278
const maxWidth = editorState . getAppSettings ( ) . maxWidth ;
275
279
const isMobile = checkIsMobile ( maxWidth ) ;
276
280
const paddingWidth = isMobile ? "4px" : "16px" ;
281
+
282
+ const childrenProps = childrenToProps ( comp . children ) ;
283
+ const theme = useContext ( ThemeContext ) ;
284
+ const compType = useContext ( CompTypeContext ) ;
285
+ const compTheme = theme ?. theme ?. components ?. [ compType ] ;
286
+
287
+ const styleProps : Record < string , any > = { } ;
288
+ [ 'style' , 'animationStyle' ] . forEach ( ( key : string ) => {
289
+ styleProps [ key ] = ( childrenProps as any ) [ key ] ;
290
+ } ) ;
291
+
292
+ useEffect ( ( ) => {
293
+ setInitialCompStyles ( {
294
+ dispatch : comp . dispatch ,
295
+ compTheme,
296
+ styleProps,
297
+ } ) ;
298
+ } , [ ] ) ;
299
+
277
300
// log.debug("renders: ", renders);
278
301
return (
279
302
< BackgroundColorContext . Provider value = { style . background } >
0 commit comments