This repository has been archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 366
createNativeComponent 现在的实现容易因为没有 ref 报 warning #478
Labels
Comments
复现代码是怎么样的 |
随便引用一个自定义组件就能复现~ import Badge from 'mini-antui/es/badge';
<View>
<Badge><View slot="inner">Remax</View></Badge>
</View> 根因就是 axml 如 |
我试了下没有警告额 |
Darmody
added a commit
that referenced
this issue
Dec 15, 2019
Darmody
added a commit
that referenced
this issue
Dec 15, 2019
Darmody
added a commit
that referenced
this issue
Dec 15, 2019
Darmody
added a commit
that referenced
this issue
Dec 15, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
bug 描述
remax 对原生小程序组件会通过 React.forwardRef 进行一层封装,其中会通过 props.__ref 往原生组件「传递」ref,在生成的 axml 中,也会通过类似
<form-0 ref="{{item.props['__ref']}}">
获取 ref~此时有个断言是,用户在使用小程序封装的组件时一定会传入 ref,但很可能没传,从而导致截图中的 warning,建议可以在用户没有传 ref 的时候,mock 一个实现,如:props.__ref = () => {}
复现步骤
使用任意一个自定义组件即可复现
期望结果
没有 warning
复现代码
😁
版本信息:
其他信息
The text was updated successfully, but these errors were encountered: