mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Merge pull request #371 from NativeScript/issue-343
Resolved issue #343.
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
import placeholder = require("ui/placeholder");
|
||||
|
||||
export function creatingView(args: placeholder.CreateViewEventData) {
|
||||
var nativeView = new android.widget.LabelView(args.context);
|
||||
var nativeView = new android.widget.TextView(args.context);
|
||||
nativeView.setText("Native");
|
||||
args.view = nativeView;
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
<Page xmlns="http://www.nativescript.org/tns.xsd">
|
||||
<StackLayout>
|
||||
<Placeholder creatingView="creatingView"/>
|
||||
<Placeholder creatingView="creatingView" width="200" height="200" backgroundColor="red"/>
|
||||
</StackLayout>
|
||||
</Page>
|
@ -11,7 +11,7 @@ export class Placeholder extends common.Placeholder {
|
||||
public _createUI() {
|
||||
var args = <definition.CreateViewEventData>{ eventName: common.Placeholder.creatingViewEvent, object: this, view: undefined, context: this._context };
|
||||
this.notify(args);
|
||||
this._android = <android.view.View>args.view;
|
||||
this._android = <android.view.View>args.view || new android.view.View(this._context);
|
||||
}
|
||||
|
||||
get android(): android.view.View {
|
||||
|
@ -10,10 +10,9 @@ export class Placeholder extends common.Placeholder {
|
||||
|
||||
get ios(): UIView {
|
||||
if (!this._ios) {
|
||||
console.trace();
|
||||
var args = <definition.CreateViewEventData>{ eventName: common.Placeholder.creatingViewEvent, object: this, view: undefined, context: undefined };
|
||||
super.notify(args);
|
||||
this._ios = args.view;
|
||||
this._ios = args.view || new UIView();
|
||||
}
|
||||
return this._ios;
|
||||
}
|
||||
@ -21,5 +20,4 @@ export class Placeholder extends common.Placeholder {
|
||||
get _nativeView(): UIView {
|
||||
return this.ios;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user