Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-24430] Views are not clickable

GitHub Issuen/a
TypeBug
Priorityn/a
StatusOpen
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsn/a
ReporterQuang Pham
AssigneeUnknown
Created2017-02-20T10:03:26.000+0000
Updated2018-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

FileDateSize
Screen Shot 2017-02-20 at 4.53.34 PM.png2017-02-20T10:00:27.000+000020346
test_widget.zip2017-02-20T09:59:04.000+000010475756

Comments

  1. Sharif AbuDarda 2017-02-20

    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.
  2. Quang Pham 2017-02-21

    I added click event (greenClick) for the Green View.
       <View id="containerGreen" class="container-green" onClick="greenClick"></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
       // viewBlue.addEventListener('postlayout', viewBlueReady);
       
    and click on the Blue View the greenClick event is now fired. The removeEventListener call is now required to prevent repeat calls :)
  3. Sharif AbuDarda 2017-02-24

    Hello, use touchEnabled :'false' in blue view as a workaround.
  4. Quang Pham 2017-02-28

    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
  5. Joe Falcone 2017-04-21

    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.

JSON Source