Ok, so I just found a way to deal with this:
First, you need to identify that the device is an IphoneX like so:
In your app.component initialize a variable that you store in a new or existing service that handles global settings for example:
export class MyApp {
//...
constructor (
//...
private settingsService: SettingService
) {
//...
const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window['MSStream'];
// Get the device pixel ratio
const ratio = window.devicePixelRatio || 1;
// Define the users device screen dimensions
const screen = {
width : window.screen.width * ratio,
height : window.screen.height * ratio
};
// iPhone X Detection
if (iOS && screen.width == 1125 && screen.height === 2436) {
// Set a global variable now we've determined the iPhoneX is true
this.settingsService.isIphoneX = true;
}
}
}
The above code is not mine, I couldn't find a reference to the original author. He or she will recognize themselves.
Anyway, once you have this code operating, you can add the following in the page you which display within the safe area .
First, declare a css class hierarchy in the variables.scss
*.display-in-safe-area-iphonex{
.scroll-content{
margin-bottom:30px;
margin-top: 40px;
}
}
Then inject that settingService in the desired page and palce this ngClass within the ion-content tag of your page like so:
<ion-content [ngClass]="{'display-in-safe-area-iphonex': settingService.isIphoneX}">
<!-- content -->
</ion-content>
I have found that 40px for the upper notch and 30px for the bottom bar work nicely.