@@ -102,14 +102,23 @@ function initRerenderEvent({
102102 leaf,
103103 dispose : [
104104 leaf ?. onPropChange ?.( ( ) => {
105+ if ( ! container . autoRepaintNode ) {
106+ return ;
107+ }
105108 __debug ( `${ schema . componentName } [${ schema . id } ] leaf not render in SimulatorRendererView, leaf onPropsChange make rerender` ) ;
106109 container . rerender ( ) ;
107110 } ) ,
108111 leaf ?. onChildrenChange ?.( ( ) => {
112+ if ( ! container . autoRepaintNode ) {
113+ return ;
114+ }
109115 __debug ( `${ schema . componentName } [${ schema . id } ] leaf not render in SimulatorRendererView, leaf onChildrenChange make rerender` ) ;
110116 container . rerender ( ) ;
111117 } ) as Function ,
112118 leaf ?. onVisibleChange ?.( ( ) => {
119+ if ( ! container . autoRepaintNode ) {
120+ return ;
121+ }
113122 __debug ( `${ schema . componentName } [${ schema . id } ] leaf not render in SimulatorRendererView, leaf onVisibleChange make rerender` ) ;
114123 container . rerender ( ) ;
115124 } ) ,
@@ -213,14 +222,18 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
213222 }
214223
215224 componentDidMount ( ) {
225+ const _leaf = this . leaf ;
226+ this . initOnPropsChangeEvent ( _leaf ) ;
227+ this . initOnChildrenChangeEvent ( _leaf ) ;
228+ this . initOnVisibleChangeEvent ( _leaf ) ;
216229 this . recordTime ( ) ;
217230 }
218231
219- get defaultState ( ) {
232+ getDefaultState ( nextProps : any ) {
220233 const {
221234 hidden = false ,
222235 condition = true ,
223- } = this . leaf ?. export ?.( TransformStage . Render ) || { } ;
236+ } = nextProps . __inner__ || this . leaf ?. export ?.( TransformStage . Render ) || { } ;
224237 return {
225238 nodeChildren : null ,
226239 childrenInState : false ,
@@ -236,19 +249,15 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
236249 // 监听以下事件,当变化时更新自己
237250 __debug ( `${ schema . componentName } [${ this . props . componentId } ] leaf render in SimulatorRendererView` ) ;
238251 clearRerenderEvent ( componentCacheId ) ;
239- const _leaf = this . leaf ;
240- this . initOnPropsChangeEvent ( _leaf ) ;
241- this . initOnChildrenChangeEvent ( _leaf ) ;
242- this . initOnVisibleChangeEvent ( _leaf ) ;
243- this . curEventLeaf = _leaf ;
252+ this . curEventLeaf = this . leaf ;
244253
245254 cache . ref . set ( componentCacheId , {
246255 makeUnitRender : this . makeUnitRender ,
247256 } ) ;
248257
249258 let cacheState = cache . state . get ( componentCacheId ) ;
250259 if ( ! cacheState || cacheState . __tag !== props . __tag ) {
251- cacheState = this . defaultState ;
260+ cacheState = this . getDefaultState ( props ) ;
252261 }
253262
254263 this . state = cacheState ;
@@ -279,6 +288,10 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
279288 singleRender ?: boolean ;
280289 } ;
281290
291+ get autoRepaintNode ( ) {
292+ return container . autoRepaintNode ;
293+ }
294+
282295 judgeMiniUnitRender ( ) {
283296 if ( ! this . renderUnitInfo ) {
284297 this . getRenderUnitInfo ( ) ;
@@ -380,13 +393,16 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
380393 const {
381394 visible,
382395 ...resetState
383- } = this . defaultState ;
396+ } = this . getDefaultState ( nextProps ) ;
384397 this . setState ( resetState ) ;
385398 }
386399
387400 /** 监听参数变化 */
388401 initOnPropsChangeEvent ( leaf = this . leaf ) : void {
389- const dispose = leaf ?. onPropChange ?.( debounce ( ( propChangeInfo : PropChangeOptions ) => {
402+ const dispose = leaf ?. onPropChange ?.( ( propChangeInfo : PropChangeOptions ) => {
403+ if ( ! this . autoRepaintNode ) {
404+ return ;
405+ }
390406 const {
391407 key,
392408 newValue = null ,
@@ -433,7 +449,7 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
433449 } ) ;
434450
435451 this . judgeMiniUnitRender ( ) ;
436- } , 30 ) ) ;
452+ } ) ;
437453
438454 dispose && this . disposeFunctions . push ( dispose ) ;
439455 }
@@ -443,6 +459,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
443459 */
444460 initOnVisibleChangeEvent ( leaf = this . leaf ) {
445461 const dispose = leaf ?. onVisibleChange ?.( ( flag : boolean ) => {
462+ if ( ! this . autoRepaintNode ) {
463+ return ;
464+ }
446465 if ( this . state . visible === flag ) {
447466 return ;
448467 }
@@ -463,6 +482,9 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
463482 */
464483 initOnChildrenChangeEvent ( leaf = this . leaf ) {
465484 const dispose = leaf ?. onChildrenChange ?.( ( param ) : void => {
485+ if ( ! this . autoRepaintNode ) {
486+ return ;
487+ }
466488 const {
467489 type,
468490 node,
@@ -540,6 +562,8 @@ export function leafWrapper(Comp: types.IBaseRenderComponent, {
540562 ref : forwardedRef ,
541563 } ;
542564
565+ delete compProps . __inner__ ;
566+
543567 return engine . createElement ( Comp , compProps , this . hasChildren ? this . children : null ) ;
544568 }
545569 }
0 commit comments