Skip to content

Commit

Permalink
feat: 添加 IComponentBlockData 类型
Browse files Browse the repository at this point in the history
  • Loading branch information
limaofeng committed Nov 23, 2021
1 parent 92434eb commit 31a9b60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hooks/useReactComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { useCallback, useEffect, useMemo, useReducer, useRef } from 'reac
import { EventEmitter } from 'events';

import ReactComponentProvider from '../sketch/ReactComponentProvider';
import { IBlockCoreData, IComponentDefinition } from '../typings';
import { IComponentBlockData, IComponentDefinition } from '../typings';
import { useDeepCompareEffect } from '../utils';

import useComponent from './useComponent';
Expand Down Expand Up @@ -63,7 +63,7 @@ function createReactComponentComponent(
};
}

export default function useReactComponent(id: string, injectProps: IBlockCoreData[] = [], options?: IOptions) {
export default function useReactComponent(id: string, injectProps: IComponentBlockData[] = [], options?: IOptions) {
const component = useComponent(id);
const emitter = useMemo<EventEmitter>(() => new EventEmitter(), []);
const state = useRef<UseReactComponentState>({ component, props: injectProps });
Expand Down
5 changes: 5 additions & 0 deletions src/typings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,11 @@ export interface ReactComponentProviderProps {
version?: number;
}

export interface IComponentBlockData {
key: string;
props: any;
}

export interface IBlockState {
version: number;
definition: IComponentDefinition;
Expand Down

0 comments on commit 31a9b60

Please sign in to comment.