Skip to content

Fix breaking change - nativeView property should have setter #4750

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 1 commit into from
Aug 25, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions tns-core-modules/application/application.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ export interface LaunchEventData extends ApplicationEventData {
* If not set a new Frame will be created as a root view in order to maintain backwards compatibility.
*/
root?: View;

savedInstanceState?: any /* android.os.Bundle */;
}

/**
Expand Down
3 changes: 3 additions & 0 deletions tns-core-modules/ui/core/view-base/view-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
// this._disableNativeViewRecycling = true;
return this.nativeViewProtected;
}
set nativeView(value: any) {
this.setNativeView(value);
}

// TODO: Use Type.prototype.typeName instead.
get typeName(): string {
Expand Down
6 changes: 3 additions & 3 deletions tns-core-modules/ui/frame/frame.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {

const app = application.android;
const intent = activity.getIntent();
let rootView = this.notifyLaunch(intent);
let rootView = this.notifyLaunch(intent, savedInstanceState);
let frameId = -1;
const extras = intent.getExtras();

Expand Down Expand Up @@ -670,8 +670,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
}

@profile
private notifyLaunch(intent: android.content.Intent): View {
const launchArgs: application.LaunchEventData = { eventName: application.launchEvent, object: application.android, android: intent };
private notifyLaunch(intent: android.content.Intent, savedInstanceState: android.os.Bundle): View {
const launchArgs: application.LaunchEventData = { eventName: application.launchEvent, object: application.android, android: intent, savedInstanceState };
application.notify(launchArgs);
return launchArgs.root;
}
Expand Down