Skip to content

Commit 44403d1

Browse files
committed
feat(statusbarPadding): add statusbar-padding css to toolbars
1 parent 5538999 commit 44403d1

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

ionic/components/navbar/navbar.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ class ToolbarBackground {
108108
'</div>',
109109
host: {
110110
'[hidden]': '_hidden',
111-
'class': 'toolbar'
111+
'class': 'toolbar',
112+
'[class.statusbar-padding]': '_sbPadding'
112113
},
113114
directives: [BackButton, BackButtonText, Icon, ToolbarBackground]
114115
})
@@ -120,6 +121,7 @@ export class Navbar extends ToolbarBase {
120121
private _bbRef: ElementRef;
121122
private _bbtRef: ElementRef;
122123
private _bgRef: ElementRef;
124+
private _sbPadding: boolean;
123125

124126
/**
125127
* @input {boolean} whether the back button should be shown or not
@@ -145,6 +147,7 @@ export class Navbar extends ToolbarBase {
145147

146148
this._bbIcon = config.get('backButtonIcon');
147149
this._bbText = config.get('backButtonText');
150+
this._sbPadding = config.getBoolean('statusbarPadding', false);
148151
}
149152

150153
/**

ionic/components/tabs/tabs.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ import {isBlank, isTrueProperty} from '../../util/util';
135135
@Component({
136136
selector: 'ion-tabs',
137137
template:
138-
'<ion-navbar-section>' +
138+
'<ion-navbar-section [class.statusbar-padding]="_sbPadding">' +
139139
'<template navbar-anchor></template>' +
140140
'</ion-navbar-section>' +
141141
'<ion-tabbar-section>' +
@@ -167,6 +167,7 @@ export class Tabs extends Ion {
167167
private _preloadTabs: boolean = null;
168168
private _tabs: Array<Tab> = [];
169169
private _onReady = null;
170+
private _sbPadding: boolean;
170171
private _useHighlight: boolean;
171172

172173
/**
@@ -238,6 +239,7 @@ export class Tabs extends Ion {
238239
this.id = ++tabIds;
239240
this.subPages = _config.getBoolean('tabSubPages');
240241
this._useHighlight = _config.getBoolean('tabbarHighlight');
242+
this._sbPadding = _config.getBoolean('statusbarPadding', false);
241243

242244
if (parent) {
243245
// this Tabs has a parent Nav

ionic/components/toolbar/toolbar.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import {Component, Directive, Host, ElementRef, Optional, forwardRef, Inject, ContentChildren, ContentChild, QueryList, ChangeDetectionStrategy, ViewEncapsulation} from 'angular2/core';
22

3+
import {Button} from '../button/button';
4+
import {Config} from '../../config/config';
35
import {Ion} from '../ion';
46
import {MenuToggle} from '../menu/menu-toggle';
57
import {Navbar} from '../navbar/navbar';
6-
import {Button} from '../button/button';
78

89

910
/**
@@ -108,14 +109,17 @@ export class ToolbarBase extends Ion {
108109
'<ng-content></ng-content>' +
109110
'</div>',
110111
host: {
111-
'class': 'toolbar'
112+
'class': 'toolbar',
113+
'[class.statusbar-padding]': '_sbPadding'
112114
},
113115
changeDetection: ChangeDetectionStrategy.OnPush,
114116
})
115117
export class Toolbar extends ToolbarBase {
118+
private _sbPadding: boolean;
116119

117-
constructor(elementRef: ElementRef) {
120+
constructor(elementRef: ElementRef, config: Config) {
118121
super(elementRef);
122+
this._sbPadding = config.getBoolean('statusbarPadding', false);
119123
}
120124

121125
}

ionic/platform/registry.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,11 @@ Platform.register({
101101
keyboardHeight: 300,
102102
mode: 'ios',
103103
scrollAssist: isIOSDevice,
104+
statusbarPadding: !!(win.cordova),
104105
swipeBackEnabled: isIOSDevice,
105106
swipeBackThreshold: 40,
106107
tapPolyfill: isIOSDevice,
107-
virtualScrollEventAssist: function() {
108-
// UIWebView needs help getting scroll events
109-
// WKWebView does not (WKWebView supports indexDB)
110-
return !(window.indexedDB);
111-
}
108+
virtualScrollEventAssist: !(window.indexedDB)
112109
},
113110
isMatch(p: Platform): boolean {
114111
return p.isPlatformMatch('ios', ['iphone', 'ipad', 'ipod'], ['windows phone']);

0 commit comments

Comments
 (0)