tidev / titanium-sdk

🚀 Native iOS and Android Apps with JavaScript
https://titaniumsdk.com/
Other
2.76k stars 1.21k forks source link

iOS: can click speed be improved? #14051

Closed m1ga closed 2 months ago

m1ga commented 5 months ago

I have searched and made sure there are no existing issues for the issue I am filing

Description

If you run this simple app on Android and iOS you'll see that the click event on Android fires quicker:

const win = Ti.UI.createWindow();
win.addEventListener("click", function(e) {
    console.log("click")
})

win.open();

I briefly looked into the iOS code and found: https://github.com/tidev/titanium-sdk/blob/2f1212fd9e46a4a8aeae0af7a850aaa7bff34e52/iphone/TitaniumKit/TitaniumKit/Sources/API/TiUIView.m#L1612-L1621

If I add another

else if ([touch tapCount] >= 2 && [proxy _hasListeners:@"click"]) { ... }

and fire a click event inside that I can click the window a lot quicker and receive click events on iOS. Has this been done on purpose?

Workaround is to use singleTap on iOS

Expected Behavior

Fire click event as fast as the user clicks

Actual behavior

small cool-down between the clicks is needed on iOS.

Reproducible sample

const win = Ti.UI.createWindow();
win.addEventListener("click", function(e) {
    console.log("click")
})

win.open();

Steps to reproduce

Platform

iOS

SDK version you are using

12.3.1

Alloy version you are using

No response

m1ga commented 2 months ago

fixed in https://github.com/tidev/titanium-sdk/pull/14115