iOS: fix callback error.Use item's node instead
This commit is contained in:
parent
658f0ed3b3
commit
bdab13209c
@ -192,13 +192,16 @@ - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)
|
|||||||
NSArray *actions = self.itemActions[@(indexPath.row)];
|
NSArray *actions = self.itemActions[@(indexPath.row)];
|
||||||
NSMutableArray <UITableViewRowAction *> *array = [NSMutableArray new];
|
NSMutableArray <UITableViewRowAction *> *array = [NSMutableArray new];
|
||||||
for (NSDictionary *action in actions) {
|
for (NSDictionary *action in actions) {
|
||||||
__weak typeof(self) _self = self;
|
|
||||||
UITableViewRowAction *tableViewRowAction = [UITableViewRowAction
|
UITableViewRowAction *tableViewRowAction = [UITableViewRowAction
|
||||||
rowActionWithStyle:UITableViewRowActionStyleNormal
|
rowActionWithStyle:UITableViewRowActionStyleNormal
|
||||||
title:action[@"title"]
|
title:action[@"title"]
|
||||||
handler:^(UITableViewRowAction *tableViewRowAction, NSIndexPath *indexPath) {
|
handler:^(UITableViewRowAction *tableViewRowAction, NSIndexPath *indexPath) {
|
||||||
__strong typeof(_self) self = _self;
|
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||||
[self callJSResponse:action[@"callback"], nil];
|
if ([cell isKindOfClass:DoricTableViewCell.class]) {
|
||||||
|
[((DoricTableViewCell *) cell).doricListItemNode callJSResponse:action[@"callback"], nil];
|
||||||
|
} else {
|
||||||
|
DoricLog(@"Cannot find table cell");
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
[action[@"backgroundColor"] let:^(id it) {
|
[action[@"backgroundColor"] let:^(id it) {
|
||||||
tableViewRowAction.backgroundColor = DoricColor(it);
|
tableViewRowAction.backgroundColor = DoricColor(it);
|
||||||
@ -212,13 +215,16 @@ - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView tra
|
|||||||
NSArray *actions = self.itemActions[@(indexPath.row)];
|
NSArray *actions = self.itemActions[@(indexPath.row)];
|
||||||
NSMutableArray<UIContextualAction *> *array = [NSMutableArray new];
|
NSMutableArray<UIContextualAction *> *array = [NSMutableArray new];
|
||||||
for (NSDictionary *action in actions) {
|
for (NSDictionary *action in actions) {
|
||||||
__weak typeof(self) _self = self;
|
|
||||||
UIContextualAction *contextualAction = [UIContextualAction
|
UIContextualAction *contextualAction = [UIContextualAction
|
||||||
contextualActionWithStyle:UIContextualActionStyleNormal
|
contextualActionWithStyle:UIContextualActionStyleNormal
|
||||||
title:action[@"title"]
|
title:action[@"title"]
|
||||||
handler:^(UIContextualAction *_Nonnull contextualAction, __kindof UIView *_Nonnull sourceView, void (^_Nonnull completionHandler)(BOOL)) {
|
handler:^(UIContextualAction *_Nonnull contextualAction, __kindof UIView *_Nonnull sourceView, void (^_Nonnull completionHandler)(BOOL)) {
|
||||||
__strong typeof(_self) self = _self;
|
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
|
||||||
[self callJSResponse:action[@"callback"], nil];
|
if ([cell isKindOfClass:DoricTableViewCell.class]) {
|
||||||
|
[((DoricTableViewCell *) cell).doricListItemNode callJSResponse:action[@"callback"], nil];
|
||||||
|
} else {
|
||||||
|
DoricLog(@"Cannot find table cell");
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
[action[@"backgroundColor"] let:^(id it) {
|
[action[@"backgroundColor"] let:^(id it) {
|
||||||
contextualAction.backgroundColor = DoricColor(it);
|
contextualAction.backgroundColor = DoricColor(it);
|
||||||
|
Reference in New Issue
Block a user