Fix crash on iOS (#5071)

* Fix crash on iOS where JS object that extend NSObject was not hold into memory.

* TS fix
This commit is contained in:
Hristo Hristov
2017-11-14 13:36:23 +02:00
committed by GitHub
parent 725475f860
commit ac3c895c89

View File

@@ -38,9 +38,9 @@ class NotificationObserver2 extends NSObject {
};
}
const observer = NotificationObserver2.initWithCallback(handleNotification);
export const __observer = NotificationObserver2.initWithCallback(handleNotification);
const notificationCenter = utils.ios.getter(NSNotificationCenter, NSNotificationCenter.defaultCenter);
notificationCenter.addObserverSelectorNameObject(observer, "onReceive", UIApplicationDidChangeStatusBarFrameNotification, null);
notificationCenter.addObserverSelectorNameObject(__observer, "onReceive", UIApplicationDidChangeStatusBarFrameNotification, null);
function handleNotification(notification: NSNotification): void {
// When there is a 40px high "in-call" status bar, nobody moves the navigationBar top from 20 to 40 and it remains underneath the status bar.