選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

functions.native.js 625B

12345678910111213141516171819202122232425262728
  1. // @flow
  2. import { isIPhoneX, Platform } from '../base/react';
  3. const IPHONE_OFFSET = 20;
  4. const IPHONEX_OFFSET = 44;
  5. /**
  6. * Determines the offset to be used for the device.
  7. * This uses a custom implementation to minimize empty area around screen,
  8. * especially on iPhone X.
  9. *
  10. * @returns {number}
  11. */
  12. export function getSafetyOffset() {
  13. if (Platform.OS === 'android') {
  14. /* Android doesn't need offset, except the Essential phone. Should be
  15. * addressed later with a generic solution.
  16. */
  17. return 0;
  18. }
  19. if (isIPhoneX()) {
  20. return IPHONEX_OFFSET;
  21. }
  22. return IPHONE_OFFSET;
  23. }