Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Shall touchEnabled: false on parent view disable it's child? [iOS-Yes, Android-No]

$
0
0

I expected a parent view with touchEnable: false to disable the events from it's child(s). The following test code has a button inside a view inside a window. The view is touchEnable: false. In iOS, only the window get the click event (as expected). In Android, pressing the button bubbles the event through all the layers. I am running Ti 3.3.0.GA. Is this a bug or feature?

var win = Ti.UI.createWindow({
    backgroundColor:'#fff',
    whichObj:'window'
});
 
var view = Ti.UI.createView({
    touchEnabled: false,
    width:'80%', height:'80%',
    backgroundColor:'yellow',
    whichObj:'view'
});
 
var btn = Ti.UI.createButton({
    title:'Button',
    width:Ti.UI.SIZE, height:Ti.UI.SIZE,
    backgroundColor:'blue',
    whichObj:'button'
});
 
btn.addEventListener('click', function(e){
    Ti.API.info('Button event handler: The '+e.source.whichObj+' object was clicked');
});
view.addEventListener('click', function(e){
    Ti.API.info('View event handler: The '+e.source.whichObj+' object was clicked');
});
win.addEventListener('click', function(e){
    Ti.API.info('Window event handler: The '+e.source.whichObj+' object was clicked');
});
 
view.add(btn);
win.add(view);
win.open();

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>