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:
Hristo Hristov
2017-08-25 11:13:51 +03:00
committed by GitHub
parent d62df3789c
commit c98443b331
3 changed files with 8 additions and 3 deletions

View File

@ -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. * If not set a new Frame will be created as a root view in order to maintain backwards compatibility.
*/ */
root?: View; root?: View;
savedInstanceState?: any /* android.os.Bundle */;
} }
/** /**

View File

@ -217,6 +217,9 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
// this._disableNativeViewRecycling = true; // this._disableNativeViewRecycling = true;
return this.nativeViewProtected; return this.nativeViewProtected;
} }
set nativeView(value: any) {
this.setNativeView(value);
}
// TODO: Use Type.prototype.typeName instead. // TODO: Use Type.prototype.typeName instead.
get typeName(): string { get typeName(): string {

View File

@ -610,7 +610,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
const app = application.android; const app = application.android;
const intent = activity.getIntent(); const intent = activity.getIntent();
let rootView = this.notifyLaunch(intent); let rootView = this.notifyLaunch(intent, savedInstanceState);
let frameId = -1; let frameId = -1;
const extras = intent.getExtras(); const extras = intent.getExtras();
@ -670,8 +670,8 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
} }
@profile @profile
private notifyLaunch(intent: android.content.Intent): View { private notifyLaunch(intent: android.content.Intent, savedInstanceState: android.os.Bundle): View {
const launchArgs: application.LaunchEventData = { eventName: application.launchEvent, object: application.android, android: intent }; const launchArgs: application.LaunchEventData = { eventName: application.launchEvent, object: application.android, android: intent, savedInstanceState };
application.notify(launchArgs); application.notify(launchArgs);
return launchArgs.root; return launchArgs.root;
} }