SafeArea: SafeArea Layout
EdgerOS App can get current safeArea information.
Functions
edger.layout.safeArea()
- Returns: {Promise} Promise object.
The returned object will have the following properties:
safeAreaInsets
{Object} SafeArea information.The current attribute has the following properties:
top
{Number} Top.left
{Number} Left.right
{Number} Right.bottom
{Number} Bottom.
Example
edger.layout.safeArea().then((data) => {
const { safeAreaInsets } = data;
console.log('Current safeAreaInfo:', safeAreaInsets);
}).catch(error => {
console.error(error);
});
async / await
async function safeArea() {
try {
return await edger.layout.safeArea();
} catch (error) {
console.error(error);
}
}
Example
edger.onAction('orientation', (data) => {
// get new safeArea information
edger.layout.safeArea()
const { orientation } = data;
console.log('Current orientation:', orientation);
});