Skip to content

Commit 9652e5d

Browse files
committed
fix(alita): 修复 TouchableHighlight 转化bug
1 parent a703228 commit 9652e5d

File tree

3 files changed

+3
-18
lines changed

3 files changed

+3
-18
lines changed

src/tran/addEventHandler.js

+1-13
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,7 @@ export default function touchableToView (ast) {
6363

6464

6565
jsxElement.children.push(
66-
t.jsxElement(
67-
t.jsxOpeningElement(
68-
t.jsxIdentifier('view'),
69-
[
70-
t.jsxAttribute(t.jsxIdentifier('diuu'), t.stringLiteral('thFabricate')),
71-
t.jsxAttribute(t.jsxIdentifier('class'), t.stringLiteral('thFabricate')),
72-
t.jsxAttribute(t.jsxIdentifier('style'), t.stringLiteral(`background-color: {{${diuu}underlayColor}}`))
73-
]
74-
),
75-
t.jsxClosingElement(t.jsxIdentifier('view')),
76-
[],
77-
true
78-
)
66+
t.jsxText(`<view class="thFabricate" style="background-color: {{${diuu}underlayColor}}"/>`)
7967
)
8068

8169

src/tran/classNameHandler.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export default function classNameHandler (ast,info) {
2323
&& path.node.name.name === 'view'
2424
) {
2525
const attris = path.node.attributes
26-
const original = (attris.filter(item => item.type === 'JSXAttribute' && item.name.name === 'original'))[0].value.value
26+
const origs = (attris.filter(item => item.type === 'JSXAttribute' && item.name.name === 'original'))
27+
const original = origs[0].value.value
2728

2829
if (original === 'View'
2930
|| original === 'AnimatedView'

src/tran/geneAllTemplate.js

-4
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,6 @@ export default function(ast, info) {
128128
const diuuAttr = getAttr(jsxOp, 'diuu')
129129
const diuuKey = diuuAttr.value.value
130130

131-
if (diuuKey === 'thFabricate') {
132-
// TouchableHighlight 产生的占位节点
133-
return
134-
}
135131

136132
const attr = path.node
137133

0 commit comments

Comments
 (0)