chore: format

This commit is contained in:
Nathan Walker
2020-07-05 14:57:06 -07:00
parent 8f2900ad0b
commit da3c0b973d
379 changed files with 71587 additions and 54582 deletions

View File

@@ -11,65 +11,76 @@ import { Trace } from "../../../trace";
export * from "./tab-content-item-common";
export class TabContentItem extends TabContentItemBase {
public nativeViewProtected: org.nativescript.widgets.GridLayout;
public tabItemSpec: org.nativescript.widgets.TabItemSpec;
public index: number;
public nativeViewProtected: org.nativescript.widgets.GridLayout;
public tabItemSpec: org.nativescript.widgets.TabItemSpec;
public index: number;
get _hasFragments(): boolean {
return true;
}
get _hasFragments(): boolean {
return true;
}
public createNativeView() {
const layout = new org.nativescript.widgets.GridLayout(this._context);
layout.addRow(new org.nativescript.widgets.ItemSpec(1, org.nativescript.widgets.GridUnitType.star));
public createNativeView() {
const layout = new org.nativescript.widgets.GridLayout(this._context);
layout.addRow(
new org.nativescript.widgets.ItemSpec(
1,
org.nativescript.widgets.GridUnitType.star
)
);
return layout;
}
return layout;
}
public initNativeView(): void {
super.initNativeView();
}
public initNativeView(): void {
super.initNativeView();
}
public _addViewToNativeVisualTree(child: View, atIndex?: number): boolean {
// Set the row property for the child
if (this.nativeViewProtected && child.nativeViewProtected) {
GridLayout.setRow(child, 0);
}
public _addViewToNativeVisualTree(child: View, atIndex?: number): boolean {
// Set the row property for the child
if (this.nativeViewProtected && child.nativeViewProtected) {
GridLayout.setRow(child, 0);
}
return super._addViewToNativeVisualTree(child, atIndex);
}
return super._addViewToNativeVisualTree(child, atIndex);
}
public disposeNativeView(): void {
super.disposeNativeView();
(<TabContentItemDefinition>this).canBeLoaded = false;
}
public disposeNativeView(): void {
super.disposeNativeView();
(<TabContentItemDefinition>this).canBeLoaded = false;
}
public _getChildFragmentManager(): androidx.fragment.app.FragmentManager {
const tabView = <TabNavigationBase>this.parent;
let tabFragment = null;
const fragmentManager = tabView._getFragmentManager();
public _getChildFragmentManager(): androidx.fragment.app.FragmentManager {
const tabView = <TabNavigationBase>this.parent;
let tabFragment = null;
const fragmentManager = tabView._getFragmentManager();
if (typeof this.index === "undefined") {
Trace.write(`Current TabContentItem index is not set`, traceCategory, Trace.messageType.error);
}
if (typeof this.index === "undefined") {
Trace.write(
`Current TabContentItem index is not set`,
traceCategory,
Trace.messageType.error
);
}
for (let fragment of (<Array<any>>fragmentManager.getFragments().toArray())) {
if (fragment.index === this.index) {
tabFragment = fragment;
break;
}
}
for (let fragment of <Array<any>>(
fragmentManager.getFragments().toArray()
)) {
if (fragment.index === this.index) {
tabFragment = fragment;
break;
}
}
// TODO: can happen in a modal tabview scenario when the modal dialog fragment is already removed
if (!tabFragment) {
// if (Trace.isEnabled()) {
// Trace.write(`Could not get child fragment manager for tab item with index ${this.index}`, traceCategory);
// }
// TODO: can happen in a modal tabview scenario when the modal dialog fragment is already removed
if (!tabFragment) {
// if (Trace.isEnabled()) {
// Trace.write(`Could not get child fragment manager for tab item with index ${this.index}`, traceCategory);
// }
// TODO: fix d.ts in view module
return (<any>tabView)._getRootFragmentManager();
}
// TODO: fix d.ts in view module
return (<any>tabView)._getRootFragmentManager();
}
return tabFragment.getChildFragmentManager();
}
return tabFragment.getChildFragmentManager();
}
}

View File

@@ -4,8 +4,8 @@
* Represents a tab navigation content entry.
*/
export class TabContentItem extends ContentView {
/**
* @private
*/
canBeLoaded?: boolean;
/**
* @private
*/
canBeLoaded?: boolean;
}

View File

@@ -4,29 +4,29 @@ import { TabContentItemBase } from "./tab-content-item-common";
export * from "./tab-content-item-common";
export class TabContentItem extends TabContentItemBase {
// tslint:disable-next-line
private __controller: UIViewController;
// tslint:disable-next-line
private __controller: UIViewController;
public setViewController(controller: UIViewController, nativeView: UIView) {
this.__controller = controller;
this.setNativeView(nativeView);
}
public setViewController(controller: UIViewController, nativeView: UIView) {
this.__controller = controller;
this.setNativeView(nativeView);
}
public disposeNativeView() {
this.__controller = undefined;
this.setNativeView(undefined);
}
public disposeNativeView() {
this.__controller = undefined;
this.setNativeView(undefined);
}
// TODO: Handle this for BOTTOM NAVIGATION with canBeLoaded in tab-cotent-item-common
// public loadView(view: ViewBase): void {
// const tabView = this.parent as TabNavigationBase;
// if (tabView && tabView.items) {
// const index = tabView.items.indexOf(this);
// TODO: Handle this for BOTTOM NAVIGATION with canBeLoaded in tab-cotent-item-common
// public loadView(view: ViewBase): void {
// const tabView = this.parent as TabNavigationBase;
// if (tabView && tabView.items) {
// const index = tabView.items.indexOf(this);
// // if (index === tabView.selectedIndex) {
// // super.loadView(view);
// // }
// super.loadView(view);
// }
// }
// // if (index === tabView.selectedIndex) {
// // super.loadView(view);
// // }
// super.loadView(view);
// }
// }
}

View File

@@ -10,21 +10,21 @@ import { ContentView } from "../../content-view";
export const traceCategory = "TabView";
@CSSType("TabContentItem")
export abstract class TabContentItemBase extends ContentView implements TabContentItemDefinition, AddChildFromBuilder {
export abstract class TabContentItemBase extends ContentView
implements TabContentItemDefinition, AddChildFromBuilder {
public eachChild(callback: (child: View) => boolean) {
if (this.content) {
callback(this.content);
}
}
public eachChild(callback: (child: View) => boolean) {
if (this.content) {
callback(this.content);
}
}
public loadView(view: ViewBase): void {
const tabView = <TabNavigationBase>this.parent;
if (tabView && tabView.items) {
// Don't load items until their fragments are instantiated.
if ((<TabContentItemDefinition>this).canBeLoaded) {
super.loadView(view);
}
}
}
public loadView(view: ViewBase): void {
const tabView = <TabNavigationBase>this.parent;
if (tabView && tabView.items) {
// Don't load items until their fragments are instantiated.
if ((<TabContentItemDefinition>this).canBeLoaded) {
super.loadView(view);
}
}
}
}