@codeleap/mobile 2.2.7 → 2.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,41 @@
1
- export declare function getMobileThemeValues(initialWindowMetrics: any): {
2
- readonly pixel: number;
3
- readonly hasNotch: boolean;
4
- readonly prefersConstantNavigationBar: boolean;
5
- readonly safeAreaTop: number;
6
- readonly safeAreaBottom: 0 | 20;
7
- readonly keyboardVerticalOffset: 57 | 47;
8
- readonly headerHeight: number;
9
- readonly tabBarHeight: any;
10
- readonly bottomNavHeight: any;
11
- readonly window: {
1
+ declare type AppValues = {
2
+ headerHeight: number;
3
+ tabBarHeight: number;
4
+ };
5
+ export declare function getMobileThemeValues(initialWindowMetrics: any, values: AppValues): {
6
+ pixel: number;
7
+ hasNotch: boolean;
8
+ prefersConstantNavigationBar: boolean;
9
+ safeAreaTop: number;
10
+ safeAreaBottom: number;
11
+ keyboardVerticalOffset: number;
12
+ headerHeight: number;
13
+ tabBarHeight: any;
14
+ bottomNavHeight: any;
15
+ window: {
12
16
  height: number;
13
17
  width: number;
14
18
  };
15
- readonly transitions: {
16
- readonly modal: {
17
- readonly duration: 100;
18
- readonly type: "timing";
19
+ transitions: {
20
+ modal: {
21
+ duration: number;
22
+ type: string;
19
23
  };
20
24
  };
21
- readonly buttons: {
22
- readonly small: {
23
- readonly height: 40;
25
+ buttons: {
26
+ small: {
27
+ height: number;
24
28
  };
25
- readonly default: {
26
- readonly height: 50;
29
+ default: {
30
+ height: number;
27
31
  };
28
- readonly large: {
29
- readonly height: 60;
32
+ large: {
33
+ height: number;
30
34
  };
31
35
  };
32
- readonly width: number;
33
- readonly height: number;
34
- readonly scale: number;
35
- readonly fontScale: number;
36
+ width: number;
37
+ height: number;
38
+ scale: number;
39
+ fontScale: number;
36
40
  };
41
+ export {};
@@ -13,7 +13,7 @@ var __assign = (this && this.__assign) || function () {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.getMobileThemeValues = void 0;
15
15
  var react_native_1 = require("react-native");
16
- function getMobileThemeValues(initialWindowMetrics) {
16
+ function getMobileThemeValues(initialWindowMetrics, values) {
17
17
  var _a, _b;
18
18
  var screenDimensions = react_native_1.Dimensions.get('screen');
19
19
  var hasNotch = react_native_1.Platform.OS === 'ios' ? (react_native_1.Dimensions.get('window').height >= 812) : (((_a = initialWindowMetrics === null || initialWindowMetrics === void 0 ? void 0 : initialWindowMetrics.insets) === null || _a === void 0 ? void 0 : _a.top) > 24 || react_native_1.StatusBar.currentHeight > 24);
@@ -21,8 +21,8 @@ function getMobileThemeValues(initialWindowMetrics) {
21
21
  var prefersConstantNavigationBar = bottomNavHeight > 0;
22
22
  var safeAreaTop = react_native_1.Platform.OS === 'ios' ? (hasNotch ? 34 : 20) : react_native_1.StatusBar.currentHeight;
23
23
  var safeAreaBottom = (hasNotch && !prefersConstantNavigationBar ? 20 : 0);
24
- return __assign(__assign({}, screenDimensions), { pixel: react_native_1.StyleSheet.hairlineWidth, hasNotch: hasNotch, prefersConstantNavigationBar: prefersConstantNavigationBar, safeAreaTop: safeAreaTop, safeAreaBottom: safeAreaBottom, keyboardVerticalOffset: react_native_1.Platform.OS === 'ios' ? 57 : 47, get headerHeight() { return 48; },
25
- get tabBarHeight() { return 63 + (prefersConstantNavigationBar ? 0 : this.safeAreaBottom); }, bottomNavHeight: bottomNavHeight, get window() {
24
+ return __assign(__assign({}, screenDimensions), { pixel: react_native_1.StyleSheet.hairlineWidth, hasNotch: hasNotch, prefersConstantNavigationBar: prefersConstantNavigationBar, safeAreaTop: safeAreaTop, safeAreaBottom: safeAreaBottom, keyboardVerticalOffset: react_native_1.Platform.OS === 'ios' ? 57 : 47, get headerHeight() { return values.headerHeight + safeAreaTop; },
25
+ get tabBarHeight() { return values.tabBarHeight + (prefersConstantNavigationBar ? 0 : this.safeAreaBottom); }, bottomNavHeight: bottomNavHeight, get window() {
26
26
  return {
27
27
  height: screenDimensions.height - (bottomNavHeight + saf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BAAgB,CAAC,KAAK;aAC9B,CAAA;QACH,CAAC,EACD,WAAW,EAAE;YACX,KAAK,EAAE;gBACL,QAAQ,EAAE,GAAG;gBACb,IAAI,EAAE,QAAQ;aACf;SACF,EACD,OAAO,EAAE;YACP,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE;aACX;YACD,OAAO,EAAE;gBACP,MAAM,EAAE,EAAE;aACX;YACD,KAAK,EAAE;gBACL,MAAM,EAAE,EAAE;aACX;SACF,IACF;AACH,CAAC;AA/CD,oDA+CC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -1,6 +1,11 @@
1
1
  import { Platform, Dimensions, StatusBar, StyleSheet } from 'react-native'
2
2
 
3
- export function getMobileThemeValues(initialWindowMetrics) {
3
+ type AppValues = {
4
+ headerHeight: number
5
+ tabBarHeight: number
6
+ }
7
+
8
+ export function getMobileThemeValues(initialWindowMetrics, values: AppValues) {
4
9
  const screenDimensions = Dimensions.get('screen')
5
10
 
6
11
  const hasNotch = Platform.OS === 'ios' ? (Dimensions.get('window').height >= 812) : (initialWindowMetrics?.insets?.top > 24 || StatusBar.currentHeight > 24)
@@ -20,8 +25,8 @@ export function getMobileThemeValues(initialWindowMetrics) {
20
25
  safeAreaTop,
21
26
  safeAreaBottom,
22
27
  keyboardVerticalOffset: Platform.OS === 'ios' ? 57 : 47,
23
- get headerHeight() { return 48 },
24
- get tabBarHeight() { return 63 + (prefersConstantNavigationBar ? 0 : this.safeAreaBottom) },
28
+ get headerHeight() { return values.headerHeight + safeAreaTop },
29
+ get tabBarHeight() { return values.tabBarHeight + (prefersConstantNavigationBar ? 0 : this.safeAreaBottom) },
25
30
  bottomNavHeight,
26
31
  get window() {
27
32
  return {
@@ -46,5 +51,5 @@ export function getMobileThemeValues(initialWindowMetrics) {
46
51
  height: 60,
47
52
  },
48
53
  },
49
- } as const
54
+ }
50
55
  }