【发布时间】:2021-01-03 05:02:30
【问题描述】:
我正在使用 ref 显示自定义警报,但我收到了关于弃用的警告,那么我该如何使用 ref 或任何替代方法?
<MyAlert ref="alert" />
this.refs.alert.open(
errorBody,
[
{
text: pbtn, onPress: () => {
this._home_call()
}
},
{ text: nbtn, onPress: () => { } }
],
{
type: 'alert',
cancelable: false,
},
);
反应版本:16.13.1
react-native 版本:0.63.2
【问题讨论】:
-
这能回答你的问题吗? Deprecation warning using this.refs
标签: android reactjs react-native ref