Reputation: 3401
How do you suppose setting a dynamic ref now?
Im getting an error cannot set property of 'test' undefined
, if I use
<View ref={(ref) => this.someRef['test'] = ref;}/>
Upvotes: 6
Views: 1765
Reputation: 11234
You have to set this.someRef
to an array or object before assigning a property to it.
this.someRef = [];
or
this.someRef = {};
Upvotes: 9