mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Disable recycling of native views
createNativeView will set iOS nativeView if it is null/undefined
This commit is contained in:
@ -346,7 +346,10 @@ function printRunTestStats() {
|
||||
messageContainer.focus();
|
||||
page.style.fontSize = 11;
|
||||
if (page.android) {
|
||||
setTimeout(() => messageContainer.dismissSoftInput());
|
||||
setTimeout(() => {
|
||||
messageContainer.dismissSoftInput();
|
||||
(<android.view.View>messageContainer.nativeView).scrollTo(0, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -604,7 +604,7 @@ export function test_BindingToDictionaryAtAppLevel() {
|
||||
pageViewModel.set("testProperty", testPropertyName);
|
||||
const dict = {};
|
||||
dict[testPropertyName] = expectedValue;
|
||||
appModule.resources["dict"] = dict;
|
||||
appModule.getResources()["dict"] = dict;
|
||||
|
||||
const testFunc = function (views: Array<View>) {
|
||||
const testLabel = <Label>(views[0]);
|
||||
@ -629,7 +629,7 @@ export function test_BindingConverterCalledEvenWithNullValue() {
|
||||
const testPropertyValue = null;
|
||||
const expectedValue = "collapsed";
|
||||
pageViewModel.set("testProperty", testPropertyValue);
|
||||
appModule.resources["converter"] = function (value) {
|
||||
appModule.getResources()["converter"] = function (value) {
|
||||
if (value) {
|
||||
return "visible";
|
||||
} else {
|
||||
|
@ -421,7 +421,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
|
||||
return result;
|
||||
};
|
||||
|
||||
app.resources["dateConverter"] = dateConverter;
|
||||
app.getResources()["dateConverter"] = dateConverter;
|
||||
|
||||
var data = new observableArray.ObservableArray();
|
||||
data.push({ date: new Date(2020, 2, 7) });
|
||||
@ -542,7 +542,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
|
||||
return value;
|
||||
}
|
||||
|
||||
app.resources["testConverter"] = testConverter;
|
||||
app.getResources()["testConverter"] = testConverter;
|
||||
|
||||
var listViewModel = new observable.Observable();
|
||||
listViewModel.set("items", [1, 2, 3]);
|
||||
@ -570,7 +570,7 @@ export class ListViewTest extends testModule.UITest<listViewModule.ListView> {
|
||||
return value;
|
||||
}
|
||||
|
||||
app.resources["testConverter"] = testConverter;
|
||||
app.getResources()["testConverter"] = testConverter;
|
||||
|
||||
var listViewModel = new observable.Observable();
|
||||
listViewModel.set("items", [1, 2, 3]);
|
||||
|
@ -264,7 +264,7 @@ export function test_usingAppLevelConvertersInRepeaterItems() {
|
||||
return result;
|
||||
};
|
||||
|
||||
app.resources["dateConverter"] = dateConverter;
|
||||
app.getResources()["dateConverter"] = dateConverter;
|
||||
|
||||
var data = new observableArray.ObservableArray();
|
||||
|
||||
|
@ -18,7 +18,6 @@ export function hasLaunched(): boolean {
|
||||
export { Observable };
|
||||
|
||||
import { UnhandledErrorEventData, iOSApplication, AndroidApplication, CssChangedEventData } from ".";
|
||||
import { NavigationEntry } from "../ui/frame";
|
||||
|
||||
export const launchEvent = "launch";
|
||||
export const suspendEvent = "suspend";
|
||||
@ -30,10 +29,11 @@ export const orientationChangedEvent = "orientationChanged";
|
||||
|
||||
let cssFile: string = "app.css";
|
||||
|
||||
export let mainModule: string;
|
||||
export let mainEntry: NavigationEntry;
|
||||
let resources: any = {};
|
||||
|
||||
export let resources: any = {};
|
||||
export function getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
export function setResources(res: any) {
|
||||
resources = res;
|
||||
|
@ -107,21 +107,23 @@ const androidApp = new AndroidApplication();
|
||||
exports.android = androidApp;
|
||||
setApplication(androidApp);
|
||||
|
||||
let mainEntry: NavigationEntry;
|
||||
let started = false;
|
||||
export function start(entry?: NavigationEntry) {
|
||||
export function start(entry?: NavigationEntry | string) {
|
||||
if (started) {
|
||||
throw new Error("Application is already started.");
|
||||
}
|
||||
|
||||
started = true;
|
||||
mainEntry = typeof entry === "string" ? { moduleName: entry } : entry;
|
||||
if (!androidApp.nativeApp) {
|
||||
const nativeApp = getNativeApplication();
|
||||
androidApp.init(nativeApp);
|
||||
}
|
||||
}
|
||||
|
||||
started = true;
|
||||
if (entry) {
|
||||
exports.mainEntry = entry;
|
||||
}
|
||||
export function getMainEntry() {
|
||||
return mainEntry;
|
||||
}
|
||||
|
||||
export function getNativeApplication(): android.app.Application {
|
||||
|
18
tns-core-modules/application/application.d.ts
vendored
18
tns-core-modules/application/application.d.ts
vendored
@ -103,23 +103,19 @@ export interface CssChangedEventData extends EventData {
|
||||
}
|
||||
|
||||
/**
|
||||
* The main page path (without the file extension) for the application starting from the application root.
|
||||
* For example if you have page called "main.js" in a folder called "subFolder" and your root folder is "app" you can specify mainModule like this:
|
||||
* var application = require("application");
|
||||
* application.mainModule = "app/subFolder/main";
|
||||
* application.start();
|
||||
* Get main entry specified when calling start function.
|
||||
*/
|
||||
export var mainModule: string;
|
||||
export function getMainEntry(): NavigationEntry;
|
||||
|
||||
/**
|
||||
* The main navigation entry to be used when loading the main Page.
|
||||
* Get application level static resources.
|
||||
*/
|
||||
export var mainEntry: NavigationEntry;
|
||||
export function getResources(): any;
|
||||
|
||||
/**
|
||||
* An application level static resources.
|
||||
* Set application level static resources.
|
||||
*/
|
||||
export var resources: any;
|
||||
export function setResources(res: any): void;
|
||||
|
||||
/**
|
||||
* Sets application level static resources.
|
||||
@ -156,7 +152,7 @@ export function off(eventNames: string, callback?: any, thisArg?: any);
|
||||
/**
|
||||
* Call this method to start the application. Important: All code after this method call will not be executed!
|
||||
*/
|
||||
export function start(entry?: NavigationEntry);
|
||||
export function start(entry?: NavigationEntry | string);
|
||||
|
||||
/**
|
||||
* A basic method signature to hook an event listener (shortcut alias to the addEventListener method).
|
||||
|
@ -188,13 +188,14 @@ const iosApp = new IOSApplication();
|
||||
exports.ios = iosApp;
|
||||
setApplication(iosApp);
|
||||
|
||||
let mainEntry: NavigationEntry;
|
||||
function createRootView(v?: View) {
|
||||
let rootView = v;
|
||||
let frame: Frame;
|
||||
let main: string | NavigationEntry;
|
||||
if (!rootView) {
|
||||
// try to navigate to the mainEntry/Module (if specified)
|
||||
main = exports.mainEntry || exports.mainModule;
|
||||
// try to navigate to the mainEntry (if specified)
|
||||
main = mainEntry;
|
||||
if (main) {
|
||||
frame = new Frame();
|
||||
frame.navigate(main);
|
||||
@ -209,12 +210,13 @@ function createRootView(v?: View) {
|
||||
return rootView;
|
||||
}
|
||||
|
||||
export function getMainEntry() {
|
||||
return mainEntry;
|
||||
}
|
||||
|
||||
let started: boolean = false;
|
||||
exports.start = function (entry?: NavigationEntry) {
|
||||
if (entry) {
|
||||
exports.mainEntry = entry;
|
||||
}
|
||||
|
||||
export function start(entry?: string | NavigationEntry) {
|
||||
mainEntry = typeof entry === "string" ? { moduleName: entry } : entry;
|
||||
started = true;
|
||||
|
||||
if (!iosApp.nativeApp) {
|
||||
@ -246,4 +248,4 @@ global.__onLiveSync = function () {
|
||||
}
|
||||
|
||||
livesync();
|
||||
}
|
||||
}
|
@ -137,11 +137,13 @@ export class ActionBar extends ActionBarBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
(<any>this.nativeView).menuItemClickListener.owner = this;
|
||||
}
|
||||
|
||||
public disposeNativeView() {
|
||||
(<any>this.nativeView).menuItemClickListener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
public onLoaded() {
|
||||
@ -365,7 +367,7 @@ export class ActionBar extends ActionBarBase {
|
||||
}
|
||||
}
|
||||
|
||||
ActionBar.prototype.recycleNativeView = true;
|
||||
// ActionBar.prototype.recycleNativeView = true;
|
||||
|
||||
let defaultTitleTextColor: number;
|
||||
|
||||
|
@ -7,7 +7,7 @@ export class ActivityIndicatorBase extends View implements ActivityIndicatorDefi
|
||||
public busy: boolean;
|
||||
}
|
||||
|
||||
ActivityIndicatorBase.prototype.recycleNativeView = true;
|
||||
// ActivityIndicatorBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const busyProperty = new Property<ActivityIndicatorBase, boolean>({ name: "busy", defaultValue: false, valueConverter: booleanConverter });
|
||||
busyProperty.register(ActivityIndicatorBase);
|
||||
|
@ -41,4 +41,4 @@ export class Border extends ContentView implements BorderDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
Border.prototype.recycleNativeView = true;
|
||||
// Border.prototype.recycleNativeView = true;
|
@ -14,4 +14,4 @@ export abstract class ButtonBase extends TextBase implements ButtonDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
ButtonBase.prototype.recycleNativeView = true;
|
||||
// ButtonBase.prototype.recycleNativeView = true;
|
@ -52,10 +52,12 @@ export class Button extends ButtonBase {
|
||||
|
||||
public initNativeView(): void {
|
||||
(<any>this.nativeView).clickListener.owner = this;
|
||||
super.initNativeView();
|
||||
}
|
||||
|
||||
public disposeNativeView() {
|
||||
(<any>this.nativeView).clickListener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
@PseudoClassHandler("normal", "highlighted", "pressed", "active")
|
||||
|
@ -92,4 +92,4 @@ export class ContentView extends CustomLayoutView implements ContentViewDefiniti
|
||||
}
|
||||
}
|
||||
|
||||
ContentView.prototype.recycleNativeView = true;
|
||||
// ContentView.prototype.recycleNativeView = true;
|
@ -348,9 +348,10 @@ export class Binding {
|
||||
let context = this.source && this.source.get && this.source.get() || global;
|
||||
let model = {};
|
||||
let addedProps = [];
|
||||
for (let prop in application.resources) {
|
||||
if (application.resources.hasOwnProperty(prop) && !context.hasOwnProperty(prop)) {
|
||||
context[prop] = application.resources[prop];
|
||||
const resources = application.getResources();
|
||||
for (let prop in resources) {
|
||||
if (resources.hasOwnProperty(prop) && !context.hasOwnProperty(prop)) {
|
||||
context[prop] = resources[prop];
|
||||
addedProps.push(prop);
|
||||
}
|
||||
}
|
||||
|
@ -659,8 +659,10 @@ export abstract class ViewBase extends Observable implements ViewBaseDefinition
|
||||
}
|
||||
} else {
|
||||
// TODO: Implement _createNativeView for iOS
|
||||
this.createNativeView();
|
||||
// this.nativeView = this._iosView = (<any>this)._nativeView;
|
||||
const nativeView = this.createNativeView();
|
||||
if (!currentNativeView && nativeView) {
|
||||
this.nativeView = this._iosView = nativeView;
|
||||
}
|
||||
}
|
||||
|
||||
this.initNativeView();
|
||||
|
@ -12,7 +12,7 @@ export class DatePickerBase extends View implements DatePickerDefinition {
|
||||
public date: Date;
|
||||
}
|
||||
|
||||
DatePickerBase.prototype.recycleNativeView = true;
|
||||
// DatePickerBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const yearProperty = new Property<DatePickerBase, number>({ name: "year", valueConverter: (v) => parseInt(v) });
|
||||
yearProperty.register(DatePickerBase);
|
||||
|
@ -64,11 +64,13 @@ export class DatePicker extends DatePickerBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
(<any>this.nativeView).listener.owner = this;
|
||||
}
|
||||
|
||||
public disposeNativeView() {
|
||||
(<any>this.nativeView).listener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
private updateNativeDate(): void {
|
||||
|
@ -150,6 +150,7 @@ export abstract class EditableTextBase extends EditableTextBaseCommon {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView = this.nativeView;
|
||||
(<any>nativeView).listener.owner = this;
|
||||
this._keyListenerCache = nativeView.getKeyListener();
|
||||
|
@ -290,12 +290,6 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
|
||||
public createNativeView() {
|
||||
// TODO: probably memory leak.
|
||||
// this._listener = new android.view.View.OnAttachStateChangeListener({
|
||||
// onViewAttachedToWindow: this.onNativeViewAttachedToWindow.bind(this),
|
||||
// onViewDetachedFromWindow: this.onNativeViewDetachedToWindow.bind(this)
|
||||
// });
|
||||
|
||||
const root = new org.nativescript.widgets.ContentLayout(this._context);
|
||||
if (this._containerViewId < 0) {
|
||||
this._containerViewId = android.view.View.generateViewId();
|
||||
@ -304,31 +298,17 @@ export class Frame extends FrameBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
this._android.rootViewGroup = this.nativeView;
|
||||
this._android.rootViewGroup.setId(this._containerViewId);
|
||||
// this._android.rootViewGroup.addOnAttachStateChangeListener(this._listener);
|
||||
}
|
||||
|
||||
// public resetNativeView() {
|
||||
// this._android.rootViewGroup.removeOnAttachStateChangeListener(this._listener);
|
||||
// }
|
||||
|
||||
public disposeNativeView() {
|
||||
// we should keep the reference to underlying native object, since frame can contain many pages.
|
||||
this._android.rootViewGroup = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
// private onNativeViewAttachedToWindow(view: android.view.View): void {
|
||||
// if (this._delayedNavigationEntry) {
|
||||
// this._navigateCore(this._delayedNavigationEntry);
|
||||
// this._delayedNavigationEntry = undefined;
|
||||
// }
|
||||
// }
|
||||
|
||||
// private onNativeViewDetachedToWindow(view: android.view.View): void {
|
||||
// // unused for the moment.
|
||||
// }
|
||||
|
||||
public _popFromFrameStack() {
|
||||
if (!this._isInFrameStack) {
|
||||
return;
|
||||
@ -795,10 +775,7 @@ class ActivityCallbacksImplementation implements AndroidActivityCallbacks {
|
||||
}
|
||||
|
||||
if (!rootView) {
|
||||
navParam = application.mainEntry;
|
||||
if (!navParam) {
|
||||
navParam = application.mainModule;
|
||||
}
|
||||
navParam = application.getMainEntry();
|
||||
|
||||
if (navParam) {
|
||||
frame = new Frame();
|
||||
|
@ -7,7 +7,7 @@ export class HtmlViewBase extends View implements HtmlViewDefinition {
|
||||
public html: string;
|
||||
}
|
||||
|
||||
HtmlViewBase.prototype.recycleNativeView = true;
|
||||
// HtmlViewBase.prototype.recycleNativeView = true;
|
||||
|
||||
// TODO: Can we use Label.ios optimization for affectsLayout???
|
||||
export const htmlProperty = new Property<HtmlViewBase, string>({ name: "html", defaultValue: "", affectsLayout: true });
|
||||
|
@ -103,7 +103,7 @@ export abstract class ImageBase extends View implements ImageDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
ImageBase.prototype.recycleNativeView = true;
|
||||
// ImageBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const imageSourceProperty = new Property<ImageBase, ImageSource>({ name: "imageSource" });
|
||||
imageSourceProperty.register(ImageBase);
|
||||
|
@ -97,11 +97,13 @@ export class Image extends ImageBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
(<any>this.nativeView).listener.owner = this;
|
||||
}
|
||||
|
||||
public disposeNativeView() {
|
||||
(<any>this.nativeView).listener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
public _createImageSourceFromSrc() {
|
||||
|
@ -21,10 +21,11 @@ export class Label extends TextBase implements LabelDefinition {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const textView = this.nativeView;
|
||||
textView.setSingleLine(true);
|
||||
// textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
|
||||
textView.setEllipsize(android.text.TextUtils.TruncateAt.END);
|
||||
}
|
||||
}
|
||||
|
||||
Label.prototype.recycleNativeView = true;
|
||||
// Label.prototype.recycleNativeView = true;
|
@ -234,4 +234,4 @@ export class Label extends TextBase implements LabelDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
Label.prototype.recycleNativeView = true;
|
||||
// Label.prototype.recycleNativeView = true;
|
@ -43,7 +43,7 @@ export class AbsoluteLayoutBase extends LayoutBase implements AbsoluteLayoutDefi
|
||||
}
|
||||
}
|
||||
|
||||
AbsoluteLayoutBase.prototype.recycleNativeView = true;
|
||||
// AbsoluteLayoutBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const leftProperty = new Property<View, Length>({
|
||||
name: "left", defaultValue: zeroLength,
|
||||
|
@ -27,7 +27,7 @@ export class DockLayoutBase extends LayoutBase implements DockLayoutDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
DockLayoutBase.prototype.recycleNativeView = true;
|
||||
// DockLayoutBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const dockProperty = new Property<View, "left" | "top" | "right" | "bottom">({
|
||||
name: "dock", defaultValue: "left", valueChanged: (target, oldValue, newValue) => {
|
||||
|
@ -209,7 +209,7 @@ export abstract class FlexboxLayoutBase extends LayoutBase {
|
||||
}
|
||||
}
|
||||
|
||||
FlexboxLayoutBase.prototype.recycleNativeView = true;
|
||||
// FlexboxLayoutBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const flexDirectionProperty = new CssProperty<Style, FlexDirection>({ name: "flexDirection", cssName: "flex-direction", defaultValue: FlexDirection.ROW, affectsLayout: isIOS, valueConverter: FlexDirection.parse });
|
||||
flexDirectionProperty.register(Style);
|
||||
|
@ -85,6 +85,7 @@ export class FlexboxLayout extends FlexboxLayoutBase {
|
||||
|
||||
public disposeNativeView() {
|
||||
(<any>this.nativeView).invalidateOrdersCache();
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
[flexDirectionProperty.getDefault](): FlexDirection {
|
||||
|
@ -305,7 +305,7 @@ export class GridLayoutBase extends LayoutBase implements GridLayoutDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
GridLayoutBase.prototype.recycleNativeView = true;
|
||||
// GridLayoutBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const columnProperty = new Property<View, number>({
|
||||
name: "col", defaultValue: 0,
|
||||
|
@ -57,6 +57,7 @@ export class GridLayout extends GridLayoutBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
// Update native GridLayout
|
||||
this.rowsInternal.forEach((itemSpec: ItemSpec, index, rows) => { this._onRowAdded(itemSpec); }, this);
|
||||
this.columnsInternal.forEach((itemSpec: ItemSpec, index, rows) => { this._onColumnAdded(itemSpec); }, this);
|
||||
@ -73,6 +74,8 @@ export class GridLayout extends GridLayoutBase {
|
||||
const itemSpec = <ItemSpec>this.columnsInternal[i];
|
||||
this._onColumnRemoved(itemSpec, i);
|
||||
}
|
||||
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
public _onRowAdded(itemSpec: ItemSpec) {
|
||||
|
@ -47,6 +47,7 @@ export class Layout extends LayoutBase implements LayoutDefinition {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
(<any>this.nativeView)[OWNER] = this;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ export class StackLayoutBase extends LayoutBase implements StackLayoutDefinition
|
||||
public orientation: "horizontal" | "vertical";
|
||||
}
|
||||
|
||||
StackLayoutBase.prototype.recycleNativeView = true;
|
||||
// StackLayoutBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const orientationProperty = new Property<StackLayoutBase, "horizontal" | "vertical">({
|
||||
name: "orientation", defaultValue: "vertical", affectsLayout: isIOS,
|
||||
|
@ -11,7 +11,7 @@ export class WrapLayoutBase extends LayoutBase implements WrapLayoutDefinition {
|
||||
public effectiveItemHeight: number;
|
||||
}
|
||||
|
||||
WrapLayoutBase.prototype.recycleNativeView = true;
|
||||
// WrapLayoutBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const itemWidthProperty = new Property<WrapLayoutBase, Length>({
|
||||
name: "itemWidth", defaultValue: "auto", affectsLayout: isIOS, valueConverter: (v) => Length.parse(v),
|
||||
|
@ -20,7 +20,7 @@ export class ListPickerBase extends View implements ListPickerDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
ListPickerBase.prototype.recycleNativeView = true;
|
||||
// ListPickerBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const selectedIndexProperty = new CoercibleProperty<ListPickerBase, number>({
|
||||
name: "selectedIndex", defaultValue: -1,
|
||||
|
@ -99,6 +99,7 @@ export class ListPicker extends ListPickerBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView = this.nativeView;
|
||||
this._selectorWheelPaint = getSelectorWheelPaint(nativeView);
|
||||
(<any>nativeView).formatter.owner = this;
|
||||
@ -119,6 +120,7 @@ export class ListPicker extends ListPickerBase {
|
||||
const nativeView = this.nativeView;
|
||||
(<any>nativeView).formatter.owner = null;
|
||||
(<any>nativeView).valueChangedListener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
private _fixNumberPickerRendering() {
|
||||
|
@ -124,7 +124,7 @@ export abstract class ListViewBase extends View implements ListViewDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
ListViewBase.prototype.recycleNativeView = true;
|
||||
// ListViewBase.prototype.recycleNativeView = true;
|
||||
|
||||
/**
|
||||
* Represents the property backing the items property of each ListView instance.
|
||||
|
@ -74,6 +74,7 @@ export class ListView extends ListViewBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeView;
|
||||
(<any>nativeView).itemClickListener.owner = this;
|
||||
const adapter = (<any>nativeView).adapter;
|
||||
|
@ -99,6 +99,7 @@ export class Page extends PageBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
this.nativeView.setBackgroundColor(-1); // White color.
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ export class ProgressBase extends View implements ProgressDefinition {
|
||||
// }
|
||||
}
|
||||
|
||||
ProgressBase.prototype.recycleNativeView = true;
|
||||
// ProgressBase.prototype.recycleNativeView = true;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the value property of each Progress instance.
|
||||
|
@ -118,7 +118,7 @@ export class Repeater extends CustomLayoutView implements RepeaterDefinition {
|
||||
|
||||
}
|
||||
|
||||
Repeater.prototype.recycleNativeView = true;
|
||||
// Repeater.prototype.recycleNativeView = true;
|
||||
|
||||
/**
|
||||
* Represents the item template property of each ListView instance.
|
||||
|
@ -132,4 +132,4 @@ export class ScrollView extends ScrollViewBase {
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView.prototype.recycleNativeView = false;
|
||||
// ScrollView.prototype.recycleNativeView = false;
|
@ -150,4 +150,4 @@ export class ScrollView extends ScrollViewBase {
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView.prototype.recycleNativeView = true;
|
||||
// ScrollView.prototype.recycleNativeView = true;
|
@ -14,7 +14,7 @@ export abstract class SearchBarBase extends View implements SearchBarDefinition
|
||||
public abstract dismissSoftInput();
|
||||
}
|
||||
|
||||
SearchBarBase.prototype.recycleNativeView = true;
|
||||
// SearchBarBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const textProperty = new Property<SearchBarBase, string>({ name: "text", defaultValue: "", affectsLayout: isIOS });
|
||||
textProperty.register(SearchBarBase);
|
||||
|
@ -108,6 +108,7 @@ export class SearchBar extends SearchBarBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.closeListener.owner = this;
|
||||
nativeView.queryTextListener.owner = this;
|
||||
@ -117,6 +118,7 @@ export class SearchBar extends SearchBarBase {
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.closeListener.owner = null;
|
||||
nativeView.queryTextListener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
[backgroundColorProperty.getDefault](): number {
|
||||
|
@ -84,7 +84,7 @@ export abstract class SegmentedBarBase extends View implements SegmentedBarDefin
|
||||
}
|
||||
}
|
||||
|
||||
SegmentedBarBase.prototype.recycleNativeView = true;
|
||||
// SegmentedBarBase.prototype.recycleNativeView = true;
|
||||
|
||||
/**
|
||||
* Gets or sets the selected index dependency property of the SegmentedBar.
|
||||
|
@ -211,6 +211,7 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = this;
|
||||
this._tabContentFactory = this._tabContentFactory || new TabContentFactory(this);
|
||||
@ -219,6 +220,7 @@ export class SegmentedBar extends SegmentedBarBase {
|
||||
public disposeNativeView() {
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
private insertTab(tabItem: SegmentedBarItem, index: number): void {
|
||||
|
@ -10,7 +10,7 @@ export class SliderBase extends View implements SliderDefinition {
|
||||
public maxValue: number;
|
||||
}
|
||||
|
||||
SliderBase.prototype.recycleNativeView = true;
|
||||
// SliderBase.prototype.recycleNativeView = true;
|
||||
|
||||
/**
|
||||
* Represents the observable property backing the value property of each Slider instance.
|
||||
|
@ -58,6 +58,7 @@ export class Slider extends SliderBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = this;
|
||||
}
|
||||
@ -65,6 +66,7 @@ export class Slider extends SliderBase {
|
||||
public disposeNativeView() {
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@ export class SwitchBase extends View implements SwitchDefinition {
|
||||
public checked: boolean;
|
||||
}
|
||||
|
||||
SwitchBase.prototype.recycleNativeView = true;
|
||||
// SwitchBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const checkedProperty = new Property<SwitchBase, boolean>({ name: "checked", defaultValue: false, valueConverter: booleanConverter });
|
||||
checkedProperty.register(SwitchBase);
|
@ -45,6 +45,7 @@ export class Switch extends SwitchBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = this;
|
||||
}
|
||||
@ -52,6 +53,7 @@ export class Switch extends SwitchBase {
|
||||
public disposeNativeView() {
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
[checkedProperty.getDefault](): boolean {
|
||||
|
@ -309,6 +309,7 @@ export class TabView extends TabViewBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
if (this._androidViewId < 0) {
|
||||
this._androidViewId = android.view.View.generateViewId();
|
||||
}
|
||||
@ -335,6 +336,7 @@ export class TabView extends TabViewBase {
|
||||
this._tabLayout = null;
|
||||
(<any>this._viewPager).listener.owner = null;
|
||||
this._viewPager = null;
|
||||
super.disposeNativeView();
|
||||
}
|
||||
|
||||
private setAdapter(items: Array<TabViewItem>) {
|
||||
|
@ -60,6 +60,7 @@ export class TextBase extends TextBaseCommon {
|
||||
super.resetNativeView();
|
||||
// We reset it here too because this could be changed by multiple properties - whiteSpace, secure, textTransform
|
||||
this.nativeView.setTransformationMethod(this._defaultTransformationMethod);
|
||||
this._defaultTransformationMethod = null;
|
||||
}
|
||||
|
||||
[textProperty.getDefault](): string {
|
||||
|
@ -8,7 +8,7 @@ export class TextFieldBase extends EditableTextBase implements TextFieldDefiniti
|
||||
public secure: boolean;
|
||||
}
|
||||
|
||||
TextFieldBase.prototype.recycleNativeView = true;
|
||||
// TextFieldBase.prototype.recycleNativeView = true;
|
||||
|
||||
export const secureProperty = new Property<TextFieldBase, boolean>({ name: "secure", defaultValue: false, valueConverter: booleanConverter });
|
||||
secureProperty.register(TextFieldBase);
|
@ -16,4 +16,4 @@ export class TextView extends EditableTextBase implements TextViewDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
TextView.prototype.recycleNativeView = true;
|
||||
// TextView.prototype.recycleNativeView = true;
|
@ -270,4 +270,4 @@ export class TextView extends EditableTextBase implements TextViewDefinition {
|
||||
}
|
||||
}
|
||||
|
||||
TextView.prototype.recycleNativeView = true;
|
||||
// TextView.prototype.recycleNativeView = true;
|
@ -95,7 +95,7 @@ export abstract class TimePickerBase extends View implements TimePickerDefinitio
|
||||
public maxMinute: number;
|
||||
}
|
||||
|
||||
TimePickerBase.prototype.recycleNativeView = true;
|
||||
// TimePickerBase.prototype.recycleNativeView = true;
|
||||
|
||||
export var minHourProperty = new Property<TimePickerBase, number>({
|
||||
name: "minHour", defaultValue: 0, valueChanged: (picker, oldValue, newValue) => {
|
||||
|
@ -53,6 +53,7 @@ export class TimePicker extends TimePickerBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
const nativeView: any = this.nativeView;
|
||||
nativeView.listener.owner = this;
|
||||
|
||||
|
@ -101,6 +101,7 @@ export class WebView extends WebViewBase {
|
||||
}
|
||||
|
||||
public initNativeView(): void {
|
||||
super.initNativeView();
|
||||
(<any>this.nativeView).client.owner = this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user