titanium-sdk
titanium-sdk copied to clipboard
iOS: Child view click events are not fired, if eventlistener is not attached at creation time
I have searched and made sure there are no existing issues for the issue I am filing
- [X] I have searched the existing issues
Description
Attaching a click eventlistener with a delay to a parent view will only register events on its direct children. Setting the extendSafeArea on window will mess things even more up. Then no events are fired.
Expected Behavior
Attaching a click eventlistener with a delay to a parent view should register events on all its children and subchildren.
Actual behavior
Attaching a click eventlistener with a delay to a parent view will only register events on its direct children.
Reproducible sample
//Will only trigger events on direct children.
setTimeout(() =>
{
$.window.addEventListener('click', onClick);
}, 10);
//Will trigger event on children its subChildren
//$.window.addEventListener('click', onClick);
function onClick(e)
{
console.debug("Click from eventlistener", e.source.id);
}
$.window.open();
//View
<Alloy>
<Window id="window">
<View id="view1" height="200" width="200" backgroundColor="red">
<View id="subview" height="100" width="100" backgroundColor="yellow"/>
</View>
</Window>
</Alloy>
Steps to reproduce
Run the code and try clicking on the yellow square. No event is registered.
Platform
iOS
SDK version you are using
12.2.0.GA
Alloy version you are using
2.0.2