新增ref检测

This commit is contained in:
荣彬 2020-07-21 15:23:34 +08:00
parent 7e7071f74f
commit 635b2e0091
2 changed files with 2 additions and 4 deletions

View File

@ -346,7 +346,7 @@ export default class BaseEngine extends Component {
engine.createElement( engine.createElement(
Comp, Comp,
props, props,
(!isFileSchema(schema) (!isFileSchema(schema) &&
!!schema.children && !!schema.children &&
this.__createVirtualDom( this.__createVirtualDom(
isJSExpression(schema.children) ? parseExpression(schema.children, self) : schema.children, isJSExpression(schema.children) ? parseExpression(schema.children, self) : schema.children,

View File

@ -268,9 +268,7 @@ export function generateI18n(locale = 'zh-CN', messages = {}) {
* @param {*} Comp 需要判断的组件 * @param {*} Comp 需要判断的组件
*/ */
export function acceptsRef(Comp) { export function acceptsRef(Comp) {
return ( return Comp && Comp.prototype && Comp.prototype.setState;
(Comp.$$typeof && Comp.$$typeof === REACT_FORWARD_REF_TYPE) || (Comp.prototype && Comp.prototype.isReactComponent)
);
} }
/** /**