Content-Length: 343850 | pFad | https://github.com/NativeScript/NativeScript/commit/89fa6ec84db8c40546b2fcc2fd151c49f1cae8c0

A3 fix(android): layout change listeners are ignored when using addEvent… · NativeScript/NativeScript@89fa6ec · GitHub
Skip to content

Commit 89fa6ec

Browse files
authored
fix(android): layout change listeners are ignored when using addEventListener (#10597)
1 parent 8877bec commit 89fa6ec

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

packages/core/ui/core/view/index.android.ts

+11-11
Original file line numberDiff line numberDiff line change
@@ -336,17 +336,17 @@ export class View extends ViewCommon {
336336
}
337337
}
338338

339-
on(eventNames: string, callback: (data: EventData) => void, thisArg?: any) {
340-
super.on(eventNames, callback, thisArg);
339+
addEventListener(eventNames: string, callback: (data: EventData) => void, thisArg?: any) {
340+
super.addEventListener(eventNames, callback, thisArg);
341341
const isLayoutEvent = typeof eventNames === 'string' ? eventNames.indexOf(ViewCommon.layoutChangedEvent) !== -1 : false;
342342

343343
if (this.isLoaded && !this.layoutChangeListenerIsSet && isLayoutEvent) {
344344
this.setOnLayoutChangeListener();
345345
}
346346
}
347347

348-
off(eventNames: string, callback?: (data: EventData) => void, thisArg?: any) {
349-
super.off(eventNames, callback, thisArg);
348+
removeEventListener(eventNames: string, callback?: (data: EventData) => void, thisArg?: any) {
349+
super.removeEventListener(eventNames, callback, thisArg);
350350
const isLayoutEvent = typeof eventNames === 'string' ? eventNames.indexOf(ViewCommon.layoutChangedEvent) !== -1 : false;
351351

352352
// Remove native listener only if there are no more user listeners for LayoutChanged event
@@ -687,13 +687,13 @@ export class View extends ViewCommon {
687687
// if the app is in background while triggering _showNativeModalView
688688
// then DialogFragment.show will trigger IllegalStateException: Can not perform this action after onSaveInstanceState
689689
// so if in background we create an event to call _showNativeModalView when loaded (going back in foreground)
690-
if (Application.inBackground && !parent.isLoaded) {
691-
const onLoaded = ()=> {
692-
parent.off('loaded', onLoaded)
693-
this._showNativeModalView(parent, options);
694-
};
695-
parent.on('loaded', onLoaded);
696-
return;
690+
if (Application.inBackground && !parent.isLoaded) {
691+
const onLoaded = () => {
692+
parent.off('loaded', onLoaded);
693+
this._showNativeModalView(parent, options);
694+
};
695+
parent.on('loaded', onLoaded);
696+
return;
697697
}
698698
super._showNativeModalView(parent, options);
699699
initializeDialogFragment();

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/NativeScript/NativeScript/commit/89fa6ec84db8c40546b2fcc2fd151c49f1cae8c0

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy