Last active
June 12, 2016 00:34
-
-
Save talkol/ffe1086dd58711477bf5685e9e10232b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is finally the full implementation of this function, all missing pieces filled in | |
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *cellIdentifier = @"CustomCell"; | |
TableViewCell *cell = (TableViewCell *)[theTableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
if (cell == nil) { | |
cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; | |
cell.cellView = [self getUnusedCell]; | |
NSLog(@"Allocated childIndex %d for row %d", (int)cell.cellView.tag, (int)indexPath.row); | |
} else { | |
NSLog(@"Recycled childIndex %d for row %d", (int)cell.cellView.tag, (int)indexPath.row); | |
} | |
// we're communicating back by dispatching an event to JS | |
NSDictionary *event = @{ | |
@"target": cell.cellView.reactTag, | |
@"childIndex": @(cell.cellView.tag), | |
@"rowID": @(indexPath.row), | |
@"sectionID": @(indexPath.section), | |
}; | |
[_eventDispatcher sendInputEventWithName:@"onChange" body:event]; | |
return cell; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment