react-native icon indicating copy to clipboard operation
react-native copied to clipboard

The JS object is released when the local module call RCTResponseSenderBlock

Open zimo888 opened this issue 11 years ago • 1 comments

XSYRequest.get(REQUEST_URL,{'source':'2','prePageLastId':'0','size':'25','start':'0'},function (response){ if (response.scode) { this.setState({ dataSource: this.state.dataSource.cloneWithRows(response.body.feeds), loaded: true, }); } });

‘XSYRequest’ is my AFNetWorking request, after the AFNetWorking asynchronous request, I would like to call this.setState, but found that ‘this’ is empty. The JS object is released when the local module is back up.

zimo888 avatar Sep 22 '15 11:09 zimo888

i modify the code var _this = this; XSYRequest.get(REQUEST_URL,{'source':'2','prePageLastId':'0','size':'25','start':'0'},function (response){ if (response.scode) { _this.setState({ dataSource: _this.state.dataSource.cloneWithRows(response.body.feeds), loaded: true, }); } });

zimo888 avatar Sep 23 '15 01:09 zimo888