mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Fix breaking change - nativeView property should have setter (#4750)
Exposed savedInstanceState on LaunchEventArgs so some controls that need Bundle to initialize could get it from there.
This commit is contained in:
@ -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 */;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 {
|
||||
|
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user