[TIMOB-24430] Views are not clickable
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Open |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | n/a |
Labels | n/a |
Reporter | Quang Pham |
Assignee | Unknown |
Created | 2017-02-20T10:03:26.000+0000 |
Updated | 2018-02-28T19:54:52.000+0000 |
Description
The Green View has click event and a child (Blue View).
The Blue View does not bubble click event to the Green View.
If it has the 'postlayout' event, it becomes clickable again
init();
function init() {
var viewBlue = Ti.UI.createView({ width: 200, height: 300, backgroundColor: 'blue' });
// // without this, viewBlue is not click-able
// viewBlue.addEventListener('postlayout', viewBlueReady);
$.containerGreen.add(viewBlue);
}
Environment:
- OSX 10.12.3
- Xcode 8.2.1
- Titanium SDK 6.0.1.GA
- iOS simulator 10.2
Attachments
File | Date | Size |
---|---|---|
Screen Shot 2017-02-20 at 4.53.34 PM.png | 2017-02-20T10:00:27.000+0000 | 20346 |
test_widget.zip | 2017-02-20T09:59:04.000+0000 | 10475756 |
Hello, Can you explain a little more what the issue really here? I see you have not define any EventListener for blue view. And you are removing removeEventListener which you haven't define. Thanks.
I added click event (greenClick) for the Green View.
Green View is parent of the Blue View. So when i clicked on the Blue View, the greenClick should be fired. But actually, greenClick is not fired. If we uncomment the following line
and click on the Blue View the greenClick event is now fired. The removeEventListener call is now required to prevent repeat calls :)
Hello, use touchEnabled :'false' in blue view as a workaround.
Thanks @Sharif AbuDarda In my real app, Green View has many Blue View, every Blue View has its id. The Blue Views must be click-able by default, but they are not. I think this maybe a bug
We've seen the same behavior with multiple ImageViews & Labels each added to its own View and then all of them added to a Parent View. We put a listener on the Parent View and expect to catch all of the events, but we only get events where the child views do not obscure the Parent View. When we set touchEnabled: false on the ImageViews, then we got the behavior we expected - click events propagating from the child Views that encapsulate the ImageViews to the Parent View. But the weird thing was that we didn't change any code and just one day our code stopped working until we added the touchEnabled: false props to the ImagesViews & Labels. And we see this ONLY on iOS using the 5.5.1 SDK with 10.3.1 libraries. We do not have to set touchEnabled on Android.