mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-22 05:21:52 +08:00
refactor(content): refactor content to remove hard reference to tabs
refactor content to remove hard reference to tabs
This commit is contained in:
@ -5,8 +5,10 @@ import { Config } from '../../config/config';
|
|||||||
import { DomController } from '../../platform/dom-controller';
|
import { DomController } from '../../platform/dom-controller';
|
||||||
import { Img } from '../img/img';
|
import { Img } from '../img/img';
|
||||||
import { Ion } from '../ion';
|
import { Ion } from '../ion';
|
||||||
|
import { isTabs } from '../../navigation/nav-util';
|
||||||
import { isTrueProperty, assert, removeArrayItem } from '../../util/util';
|
import { isTrueProperty, assert, removeArrayItem } from '../../util/util';
|
||||||
import { Keyboard } from '../../platform/keyboard';
|
import { Keyboard } from '../../platform/keyboard';
|
||||||
|
import { NavController } from '../../navigation/nav-controller';
|
||||||
import { Platform } from '../../platform/platform';
|
import { Platform } from '../../platform/platform';
|
||||||
import { ScrollView, ScrollEvent } from '../../util/scroll-view';
|
import { ScrollView, ScrollEvent } from '../../util/scroll-view';
|
||||||
import { Tabs } from '../tabs/tabs';
|
import { Tabs } from '../tabs/tabs';
|
||||||
@ -143,6 +145,8 @@ export class Content extends Ion implements OnDestroy, OnInit {
|
|||||||
/** @internal */
|
/** @internal */
|
||||||
_ftrHeight: number;
|
_ftrHeight: number;
|
||||||
/** @internal */
|
/** @internal */
|
||||||
|
_tabs: Tabs;
|
||||||
|
/** @internal */
|
||||||
_tabbarHeight: number;
|
_tabbarHeight: number;
|
||||||
/** @internal */
|
/** @internal */
|
||||||
_tabsPlacement: string;
|
_tabsPlacement: string;
|
||||||
@ -327,7 +331,7 @@ export class Content extends Ion implements OnDestroy, OnInit {
|
|||||||
public _keyboard: Keyboard,
|
public _keyboard: Keyboard,
|
||||||
public _zone: NgZone,
|
public _zone: NgZone,
|
||||||
@Optional() viewCtrl: ViewController,
|
@Optional() viewCtrl: ViewController,
|
||||||
@Optional() public _tabs: Tabs
|
@Optional() navCtrl: NavController
|
||||||
) {
|
) {
|
||||||
super(config, elementRef, renderer, 'content');
|
super(config, elementRef, renderer, 'content');
|
||||||
|
|
||||||
@ -337,6 +341,14 @@ export class Content extends Ion implements OnDestroy, OnInit {
|
|||||||
this._imgVelMax = config.getNumber('imgVelocityMax', 3);
|
this._imgVelMax = config.getNumber('imgVelocityMax', 3);
|
||||||
this._scroll = new ScrollView(_plt, _dom);
|
this._scroll = new ScrollView(_plt, _dom);
|
||||||
|
|
||||||
|
while (navCtrl) {
|
||||||
|
if (isTabs(<any>navCtrl)) {
|
||||||
|
this._tabs = <any>navCtrl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
navCtrl = navCtrl.parent;
|
||||||
|
}
|
||||||
|
|
||||||
if (viewCtrl) {
|
if (viewCtrl) {
|
||||||
// content has a view controller
|
// content has a view controller
|
||||||
viewCtrl._setIONContent(this);
|
viewCtrl._setIONContent(this);
|
||||||
|
Reference in New Issue
Block a user