Skip to content

Commit c98443b

Browse files
author
Hristo Hristov
authored
Fix breaking change - nativeView property should have setter (NativeScript#4750)
Exposed savedInstanceState on LaunchEventArgs so some controls that need Bundle to initialize could get it from there.
1 parent d62df37 commit c98443b

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

tns-core-modules/application/application.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export interface LaunchEventData extends ApplicationEventData {
8080
* If not set a new Frame will be created as a root view in order to maintain backwards compatibility.
8181
*/
8282
root?: View;
83+
84+
savedInstanceState?: any /* android.os.Bundle */;
8385
}
8486

8587
/**

tns-core-modules/ui/core/view-base/view-base.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
217217
// this._disableNativeViewRecycling = true;
218218
return this.nativeViewProtected;
219219
}
220+
set nativeView(value: any) {
221+
this.setNativeView(value);
222+
}
220223

221224
// TODO: Use Type.prototype.typeName instead.
222225
get typeName(): string {

tns-core-modules/ui/frame/frame.android.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
610610

611611
const app = application.android;
612612
const intent = activity.getIntent();
613-
let rootView = this.notifyLaunch(intent);
613+
let rootView = this.notifyLaunch(intent, savedInstanceState);
614614
let frameId = -1;
615615
const extras = intent.getExtras();
616616

@@ -670,8 +670,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
670670
}
671671

672672
@profile
673-
private notifyLaunch(intent: android.content.Intent): View {
674-
const launchArgs: application.LaunchEventData = { eventName: application.launchEvent, object: application.android, android: intent };
673+
private notifyLaunch(intent: android.content.Intent, savedInstanceState: android.os.Bundle): View {
674+
const launchArgs: application.LaunchEventData = { eventName: application.launchEvent, object: application.android, android: intent, savedInstanceState };
675675
application.notify(launchArgs);
676676
return launchArgs.root;
677677
}

0 commit comments

Comments
 (0)