mirror of
https://github.com/zhigang1992/nativewind.git
synced 2026-06-16 02:34:28 +08:00
fix: move babel named import into jsx visitor
This commit is contained in:
@@ -64,18 +64,13 @@ export function styledComponentTransform(
|
||||
PluginPass & {
|
||||
opts: StyledComponentTransformOptions;
|
||||
isInContent?: boolean;
|
||||
didTransform?: boolean;
|
||||
addedNativeWindImport?: boolean;
|
||||
}
|
||||
> = {
|
||||
Program: {
|
||||
enter(_, state) {
|
||||
state.blockList = new Set();
|
||||
},
|
||||
exit(path, state) {
|
||||
if (state.didTransform) {
|
||||
addNamed(path, "StyledComponent", "nativewind");
|
||||
}
|
||||
},
|
||||
},
|
||||
JSXElement(path, state) {
|
||||
const filename = state.filename;
|
||||
@@ -126,7 +121,11 @@ export function styledComponentTransform(
|
||||
path.node.children
|
||||
)
|
||||
);
|
||||
state.didTransform = true;
|
||||
|
||||
if (!state.addedNativeWindImport) {
|
||||
state.addedNativeWindImport = true;
|
||||
addNamed(path, "StyledComponent", "nativewind");
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user