14
14
* jsxPropsMap: 属性是JSX片段,包括方法返回JSX片段等,Alita需要特殊处理这些属性
15
15
* extChildComp: 需要处理children 为childrencpt的集合
16
16
* extReactComp:一般来说对齐的组件 需要继承于 RNBaseComponent,但是有些复杂的组件需要继承于Component/PureComponent,比如FlatList
17
+ * textComp: Text节点,一般来说只要官方的Text组件
17
18
* allExtComp:所有组件,包括RN官方组件,配置在extCompLibs里的组件,这些组件在Alita转化的时候,会当做基本组件,基本组件的属性处理和自定义组件有一些区别
18
19
* @param extCompLibs
19
20
* @returns {{extCompPathMaps, extChildComp: Set, extReactComp: Set, allExtComp: Set, jsxPropsMap} }
@@ -23,6 +24,7 @@ export default function getExtCompPathMaps(extCompLibs) {
23
24
const jsxPropsMap = { }
24
25
const extChildComp = new Set ( [ ] )
25
26
const extReactComp = new Set ( [ ] )
27
+ const textComp = new Set ( [ 'Text' ] )
26
28
const allExtComp = new Set ( [ ] )
27
29
for ( let i = 0 ; i < extCompLibs . length ; i ++ ) {
28
30
const extLib = extCompLibs [ i ]
@@ -44,7 +46,13 @@ export default function getExtCompPathMaps(extCompLibs) {
44
46
compPathMap [ compName ] = `${ wxLibName } ${ compDir } ${ compName } /index`
45
47
allExtComp . add ( compName )
46
48
} else {
47
- const { name, extendsComponent, needOperateChildren, jsxProps} = compName
49
+ const {
50
+ name,
51
+ extendsComponent,
52
+ needOperateChildren,
53
+ jsxProps,
54
+ textChildren
55
+ } = compName
48
56
compPathMap [ name ] = `${ wxLibName } ${ compDir } ${ name } /index`
49
57
50
58
if ( needOperateChildren === true ) {
@@ -59,6 +67,10 @@ export default function getExtCompPathMaps(extCompLibs) {
59
67
jsxPropsMap [ name ] = jsxProps
60
68
}
61
69
70
+ if ( textChildren === true ) {
71
+ textComp . add ( name )
72
+ }
73
+
62
74
allExtComp . add ( name )
63
75
}
64
76
@@ -70,6 +82,7 @@ export default function getExtCompPathMaps(extCompLibs) {
70
82
extChildComp,
71
83
extReactComp,
72
84
allExtComp,
85
+ textComp,
73
86
jsxPropsMap
74
87
}
75
88
}
0 commit comments