[v2] iPhone X class support
This is a (multiple allowed):
-
[ ] bug
-
[x] enhancement
-
[ ] feature-discussion (RFC)
-
Platform and Target: iOS 11, iPhone X
Hi Vladimir, please add css helper class for iPhone X (statusbar and toolbar padding on portrait view and left/right margin on landscape view).

add code to file css
@media only screen and (device-width : 375px) and (device-height : 812px) and (-webkit-device-pixel-ratio : 3) { .navbar { height: calc(constant(safe-area-inset-bottom) + 22px); height: calc(env(safe-area-inset-bottom) + 22px); left: 0; bottom: 0; } }
.toolbar { height: calc(constant(safe-area-inset-bottom) + 44px); height: calc(env(safe-area-inset-bottom) + 44px); left: 0; bottom: 0; }
Thank for help :)
Did he work with you well?
Now i look - in toolbar: icons position are ok, but text labels are in the same place

I can not determine the problem. Can you upload files to see where the bugs are.
A class added to html by simulator:
<html lang='en' class="ios device-pixel-ratio-3 device-retina device-ios device-ios-11 device-ios-11-1 device-ios-gt-10 device-ios-gt-9 device-ios-gt-8 device-ios-gt-7 device-ios-gt-6 support-position-sticky with-statusbar">
My app tree:
` <div id="app">
<div class="statusbar"></div>
<div class="panel panel-left panel-reveal"></div>
<div class="view view-main"></div>
</div>`
In main viev i route:
<div class="page">
<div class="popup add-zadanie"></div>
<div class="navbar">
<div class="navbar-inner">
<div class="left">
<a href="#" class="link icon-only panel-open">
<i class="icon f7-icons ios-only">bars</i>
<i class="icon material-icons md-only">dehaze</i>
</a>
</div>
<div class="title sliding n-title">{{title}}</div>
<div class="right n-right">
<a class="link icon-only popup-open" data-popup=".add-zadanie">
<i class="icon f7-icons ios-only">add</i>
<i class="icon material-icons md-only">add</i>
</a>
</div>
</div>
</div>
<div class="toolbar tabbar tabbar-labels">
<div class="toolbar-inner">
<a href="./" class="tab-link" data-route-tab-id="tlist">
<i class="icon f7-icons ios-only">check_round</i>
<i class="icon icon-fill f7-icons ios-only">check_round_fill</i>
<i class="icon material-icons md-only">check_circle</i>
<span class="tabbar-label">Zadania</span>
</a>
<a href="t11/" class="tab-link" data-route-tab-id="t11">
<i class="icon fa fa-handshake-o fa-18x"></i>
<i class="icon icon-fill fa fa-handshake-o fa-18x ios-only"></i>
<span class="tabbar-label">1:1</span>
</a>
<a href="trek/" class="tab-link" data-route-tab-id="trek">
<i class="icon fa fa-sticky-note-o ios-only fa-18x"></i>
<i class="icon icon-fill fa fa-sticky-note ios-only fa-18x"></i>
<i class="icon fa fa-sticky-note-o md-only fa-18x"></i>
<span class="tabbar-label">Rekomendacje</span>
</a>
<a href="tszk/" class="tab-link" data-route-tab-id="tszk">
<i class="icon fa fa-graduation-cap fa-18x"></i>
<i class="icon icon-fill fa fa-graduation-cap fa-18x ios-only"></i>
<span class="tabbar-label">Szkolenia</span>
</a>
<a href="tmes/" class="tab-link" data-route-tab-id="tmes">
<i class="icon ios-only fa fa-comments-o fa-18x"></i>
<i class="icon icon-fill ios-only fa fa-comments fa-18x"></i>
<i class="icon material-icons md-only">chat_bubble</i>
<span class="tabbar-label">Wiadomości</span>
</a>
</div>
</div>
<div class="tabs tabs-routable">
<div class="page-content tab hide-toolbar-on-scroll hide-navbar-on-scroll" id="tlist"></div>
<div class="page-content tab hide-toolbar-on-scroll hide-navbar-on-scroll" id="t11"></div>
<div class="page-content tab hide-toolbar-on-scroll hide-navbar-on-scroll" id="trek"></div>
<div class="page-content tab hide-toolbar-on-scroll hide-navbar-on-scroll" id="tszk"></div>
<div class="page-content tab" id="tmes"></div>
</div>
</div>
Tab content is also routable.
You try this workaround that probably works for you
Go to the file framework7.ios.css
Then to line 1181 ..navbar-inner, .toolbar-inner
Disable height: 100%;
This is my css for iphone X for portrait and landscape:
@media only screen
and (device-width : 375px)
and (device-height : 812px)
and (-webkit-device-pixel-ratio : 3)
and (orientation : landscape) {
.navbar {
height: calc(constant(safe-area-inset-bottom) + 22px) !important;
height: calc(env(safe-area-inset-bottom) + 22px) !important;
left: 0;
bottom: 0;
}
.toolbar {
height: calc(constant(safe-area-inset-bottom) + 65px) !important;
height: calc(env(safe-area-inset-bottom) + 65px) !important;
left: 0;
bottom: 0;
}
.ios .toolbar-inner {
padding: 8px 44px;
height: auto;
}
.ios .navbar-inner {
height: 100%;
padding-top: 11px;
}
html.with-statusbar.device-ios .framework7-root, html.with-statusbar.ios:not(.device-ios):not(.device-android) .framework7-root { padding-top: 0;}
html.with-statusbar .statusbar {display: none;}
}
@media only screen
and (device-width : 375px)
and (device-height : 812px)
and (-webkit-device-pixel-ratio : 3)
and (orientation : portrait) {
html.with-statusbar.device-ios .panel, html.with-statusbar.ios:not(.device-ios):not(.device-android) .panel {
height: 100%;
top:0;
}
html.with-statusbar.device-ios .panel, html.with-statusbar.ios:not(.device-ios):not(.device-android) .panel .page {
padding-top: 22px;
}
.navbar {
height: calc(constant(safe-area-inset-bottom) + 44px) !important;
height: calc(env(safe-area-inset-bottom) + 44px) !important;
left: 0;
bottom: 0;
}
.toolbar {
height: calc(constant(safe-area-inset-bottom) + 44px) !important;
height: calc(env(safe-area-inset-bottom) + 44px) !important;
left: 0;
bottom: 0;
}
.ios .toolbar-inner {
padding: 8px 8px;
height: auto;
}
.ios .navbar-inner {
height: 100%;
padding-top: 33px;
}
html.with-statusbar.device-ios .framework7-root, html.with-statusbar.ios:not(.device-ios):not(.device-android) .framework7-root { padding-top: 0;}
html.with-statusbar .statusbar {display: none;}
.page-content {
padding-top: 55px !important;
}
}
Everything looks and works ok, but in landscape mode every element (eg. navbar left and right item, list, text block...) must left and right padding 44px (i think). I'm looking for a simply method :)
Thanks for help!
Thanks.
To remove any white bars at the bottom and to correct the size of the toolbar in landscape mode I modified your code bit:
@media only screen
and (device-width : 375px)
and (device-height : 812px)
and (-webkit-device-pixel-ratio : 3)
and (orientation : landscape) {
.framework7-root{height:375px}
.page-content{padding-left: 44px;padding-right: 44px;}
.navbar {
height: calc(constant(safe-area-inset-bottom) + 22px) !important;
height: calc(env(safe-area-inset-bottom) + 22px) !important;
left: 0;
bottom: 0;
}
.toolbar {
height: calc(constant(safe-area-inset-bottom) + 44px) !important;
height: calc(env(safe-area-inset-bottom) + 44px) !important;
left: 0;
bottom: 0;
}
.ios .toolbar-inner {
padding: 8px 44px;
height: auto;
}
.ios .navbar-inner {
height: 100%;
padding-top: 11px;
}
html.with-statusbar.device-ios .framework7-root, html.with-statusbar.ios:not(.device-ios):not(.device-android) .framework7-root { padding-top: 0;}
html.with-statusbar .statusbar {display: none;}
}
@media only screen
and (device-width : 375px)
and (device-height : 812px)
and (-webkit-device-pixel-ratio : 3)
and (orientation : portrait) {
.framework7-root{height:812px}
html.with-statusbar.device-ios .panel, html.with-statusbar.ios:not(.device-ios):not(.device-android) .panel {
height: 100%;
top:0;
}
html.with-statusbar.device-ios .panel, html.with-statusbar.ios:not(.device-ios):not(.device-android) .panel .page {
padding-top: 22px;
}
.navbar {
height: calc(constant(safe-area-inset-bottom) + 44px) !important;
height: calc(env(safe-area-inset-bottom) + 44px) !important;
left: 0;
bottom: 0;
}
.toolbar {
height: calc(constant(safe-area-inset-bottom) + 44px) !important;
height: calc(env(safe-area-inset-bottom) + 44px) !important;
left: 0;
bottom: 0;
}
.ios .toolbar-inner {
padding: 8px 8px;
height: auto;
}
.ios .navbar-inner {
height: 100%;
padding-top: 33px;
}
html.with-statusbar.device-ios .framework7-root, html.with-statusbar.ios:not(.device-ios):not(.device-android) .framework7-root { padding-top: 0;}
html.with-statusbar .statusbar {display: none;}
.page-content {
padding-top: 55px !important;
}
}
You must use "viewport-fit=cover" for viewport meta tag & "safe-area-inset-left", "safe-area-inset-right", "safe-area-inset-top", and "safe-area-inset-bottom" for padding
More Info can be found here: https://webkit.org/blog/7929/designing-websites-for-iphone-x/
Hi @vemaSolutions just wanted to double check which code did you end up using to handle the iPhone X? Safe zones have been added to FM7 which makes the App in the middle which is great but would like to try this out to see if I can make it fit properly
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.