Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TIMOB-16680] iOS: listView when views overlap itemclick event return wrong bindId #6211

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 21 additions & 20 deletions iphone/Classes/TiUIListView.m
Original file line number Diff line number Diff line change
Expand Up @@ -1864,26 +1864,27 @@ + (UITableViewRowAnimation)animationStyleForProperties:(NSDictionary*)properties

static TiViewProxy * FindViewProxyWithBindIdContainingPoint(UIView *view, CGPoint point)
{
if (!CGRectContainsPoint([view bounds], point)) {
return nil;
}
for (UIView *subview in [view subviews]) {
TiViewProxy *viewProxy = FindViewProxyWithBindIdContainingPoint(subview, [view convertPoint:point toView:subview]);
if (viewProxy != nil) {
id bindId = [viewProxy valueForKey:@"bindId"];
if (bindId != nil) {
return viewProxy;
}
}
}
if ([view isKindOfClass:[TiUIView class]]) {
TiViewProxy *viewProxy = (TiViewProxy *)[(TiUIView *)view proxy];
id bindId = [viewProxy valueForKey:@"bindId"];
if (bindId != nil) {
return viewProxy;
}
}
return nil;
if (!CGRectContainsPoint([view bounds], point)) {
return nil;
}
for (int i = [view.subviews count]-1; i >=0; i--){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put a (int) cast here, (int)[views.subviews count]-1
to remove Xcode warning.

UIView *subview = [view.subviews objectAtIndex:i];
TiViewProxy *viewProxy = FindViewProxyWithBindIdContainingPoint(subview, [view convertPoint:point toView:subview]);
if (viewProxy != nil) {
id bindId = [viewProxy valueForKey:@"bindId"];
if (bindId != nil && subview.userInteractionEnabled) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove subview.userInteractionEnabled. The default value is not necessarily true for all UI components. It will confuse the developers to have an extra check to make sure this condition is fulfilled. Moreover, this check is not necessary to solve this ticket. So if this particular issue arises in the future, we will open another ticket.

return viewProxy;
}
}
}
if ([view isKindOfClass:[TiUIView class]]) {
TiViewProxy *viewProxy = (TiViewProxy *)[(TiUIView *)view proxy];
id bindId = [viewProxy valueForKey:@"bindId"];
if (bindId != nil) {
return viewProxy;
}
}
return nil;
}

#endif