iPhone X Styles

With the iPhone X release, Apple introduced so called “safe areas”, when the app UI must include additional top/bottom spacing (to consider top notch and new bottom bar) in portrait orientation and additional left/righ spacing (to consider left/right notch) in landscape orientation.

In portrait orientation Framework7 will do required styles modifications automatically, but in landscape orientation some additional classes must be added to elements:

  • ios-edges - add to element that is stick to left/right screen edges in landscape orientation
  • ios-left-edge - add to element that is stick to the left screen edge in landscape orientation
  • ios-right-edge - add to element that is stick to the right screen edge in landscape orientation
  • no-ios-edges - add to element which is is inside of ios-edges to remove additional horizontal spacing
  • no-ios-left-edge - add to element which is is inside of ios-edges to remove additional left spacing
  • no-ios-right-edge - add to element which is is inside of ios-edges to remove additional right spacing

The following elements don’t require such classes:

  • Popup, Sheet - already considered as full screen elements that is required extra spacing on both left and right sides
  • Left Panel - already considered as element that is stick to the left screen edge and requires extra spacing on left side
  • Right Panel - already considered as element that is stick to the right screen edge and requires extra spacing on right side

Here is the example app layout with such classes:

  1. <body>
  2. <!-- app root -->
  3. <div id="app">
  4. <!-- statusbar -->
  5. <div class="statusbar"></div>
  6. <!-- left panel doesn't require any additional classes -->
  7. <div class="panel panel-left panel-cover">
  8. ...
  9. </div>
  10. <!-- right panel doesn't require any additional classes -->
  11. <div class="panel panel-right panel-reveal">
  12. ...
  13. </div>
  14. <!-- main view, full-wide element, add "ios-edges" class -->
  15. <div class="view view-main view-init ios-edges" data-url="/">
  16. <div class="page">
  17. <div class="navbar">
  18. ...
  19. </div>
  20. <div class="page-content">
  21. <!-- full-wide list, will inherit ios-edges from view -->
  22. <div class="list">
  23. ...
  24. </div>
  25. <!-- full-wide content block, will inherit ios-edges from view -->
  26. <div class="block">
  27. ...
  28. </div>
  29. <!--
  30. two-columns blocks: need to
  31. - remove extra spacing on right side for left block
  32. - remove extra spacing on left side for right block
  33. -->
  34. <div class="row">
  35. <!-- remove right spacing on left block -->
  36. <div class="block col no-ios-right-edge">
  37. ...
  38. </div>
  39. <!-- remove left spacing on right block -->
  40. <div class="block col no-ios-left-edge">
  41. ...
  42. </div>
  43. </div>
  44. ...
  45. </div>
  46. </div>
  47. </div>
  48. </div>
  49. <script src="../packages/core/js/framework7.min.js"></script>
  50. <script src="js/routes.js"></script>
  51. <script src="js/app.js"></script>
  52. </body>