Content-Length: 277221 | pFad | http://github.com/NativeScript/NativeScript/pull/10597/files

76 fix(android): Layout change listeners are ignored when using addEventListener by CatchABus · Pull Request #10597 · NativeScript/NativeScript · GitHub
Skip to content

fix(android): Layout change listeners are ignored when using addEventListener #10597

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions packages/core/ui/core/view/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,17 +336,17 @@ export class View extends ViewCommon {
}
}

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

if (this.isLoaded && !this.layoutChangeListenerIsSet && isLayoutEvent) {
this.setOnLayoutChangeListener();
}
}

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

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








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: http://github.com/NativeScript/NativeScript/pull/10597/files

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy