Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 修复 createHostComponent 无法正确注册组件的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Dec 17, 2020
1 parent 5f723ac commit 7ca4938
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions packages/remax-macro/src/createHostComponent.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import * as t from '@babel/types';
import { NodePath } from '@babel/traverse';
import { HostComponent } from '@remax/types';
import Store from '@remax/build-store';
import insertImportDeclaration from './utils/insertImportDeclaration';

const PACKAGE_NAME = '@remax/runtime';
const FUNCTION_NAME = 'createHostComponent';

export const hostComponents: Map<string, HostComponent> = new Map();

function getConfig(callExpression: NodePath<t.CallExpression>) {
const args = callExpression.node.arguments;
const name = args[0] as t.StringLiteral;
Expand Down Expand Up @@ -38,7 +36,7 @@ export default function createHostComponent(path: NodePath, state: any) {
return prev;
}, {});

hostComponents.set(name.value, {
Store.registeredHostComponents.set(name.value, {
props,
alias,
additional: true,
Expand Down

1 comment on commit 7ca4938

@vercel
Copy link

@vercel vercel bot commented on 7ca4938 Dec 17, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.