您如何设置动态参考?我得到一个错误cannot set property of 'test' undefined
,如果我使用
<View ref={(ref) => this.someRef['test'] = ref;}/>
Run Code Online (Sandbox Code Playgroud)
在为其this.someRef
分配属性之前,必须设置为数组或对象.
this.someRef = [];
or
this.someRef = {};
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1477 次 |
最近记录: |