Some of us would like to be able to subclass UIApplication so we can override the sendEvent method on ios. This is needed to detect user events that occur anywhere in the application like on the keyboard and without having to attach listeners everywhere - to each and every one of the controls.
Describe the solution you'd like
Just like we can implement UIApplicationDelegate:
class MyDelegate extends UIResponder implements UIApplicationDelegate {
public static ObjCProtocols = [UIApplicationDelegate];
touchesBeganWithEvent(touches: NSSet<UITouch>, event: _UIEvent): void {
console.log("touches began");
// will not be invoken when touch is on keybaord or is on a control
}
}
application.ios.delegate = MyDelegate;
@Lelelo1 commented on Wed Jul 03 2019
Some of us would like to be able to subclass
UIApplication
so we can override thesendEvent
method on ios. This is needed to detect user events that occur anywhere in the application like on the keyboard and without having to attach listeners everywhere - to each and every one of the controls.Describe the solution you'd like Just like we can implement
UIApplicationDelegate
:...described here
It would be nice if we could:
before running app
application.run({ moduleName: "app-root"});
.Describe alternatives you've considered Add an additional property in application.ios that contains the
UIApplication
subclass to be used if given.Additional context
From
application.ios.js
inside application module:The third argument should probably be
NSStringFromClass(iosApp.nativeApp)
, and theif(!iosApp.nativeApp)
check has to redesigned.where principalClassName should be the name of the
UIApplication
subclass if given.