RCT_EXPORT_MODULE()
- (UIView *)view
{
return [[RNNativeListview alloc] initWithBridge:self.bridge];
}
RCT_EXPORT_VIEW_PROPERTY(rowHeight, float)
RCT_EXPORT_VIEW_PROPERTY(numRows, NSInteger)
I want to reload my UITableView whenever js updates numRows. How do I listen for this?
I don't think that KVO is a good solution.
You can just override setter for numRows property:
- (void)setNumRows:(NSInteger)numRows {
_numRows = numRows;
[self.tableView reloadData];
}
Or you can use RCT_CUSTOM_VIEW_PROPERTY:
RCT_CUSTOM_VIEW_PROPERTY(numRows, NSInteger, RNNativeListview) {
view.numRows = [RCTConvert NSInteger:json];
[view.tableView reloadData];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With