react-native-unit-components 3.1.2-beta.1 → 3.1.2-beta.2

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.
@@ -10,6 +10,7 @@ import com.unitreactnativecomponents.nativeModules.security.UNSecurityHelperModu
10
10
  import com.unitreactnativecomponents.nativeModules.sharefile.UNShareFile
11
11
  import com.unitreactnativecomponents.nativeModules.unStoreModule.UNStoreModule
12
12
  import com.unitreactnativecomponents.nativeModules.unComponentsSnapshotProtectionModule.UNComponentsSnapshotProtectionModule
13
+ import com.unitreactnativecomponents.nativeModules.navigationBar.UNNavigationBarModule
13
14
 
14
15
  class UnitReactNativeComponentsPackage : ReactPackage {
15
16
  override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
@@ -26,6 +27,7 @@ class UnitReactNativeComponentsPackage : ReactPackage {
26
27
  modules.add(UNStoreModule(reactContext))
27
28
  modules.add(UNSecurityHelperModule(reactContext))
28
29
  modules.add(UNComponentsSnapshotProtectionModule(reactContext))
30
+ modules.add(UNNavigationBarModule(reactContext))
29
31
  return modules
30
32
  }
31
33
  }
@@ -0,0 +1,38 @@
1
+ package com.unitreactnativecomponents.nativeModules.navigationBar
2
+
3
+ import android.view.WindowManager
4
+ import com.facebook.react.bridge.Promise
5
+ import com.facebook.react.bridge.ReactApplicationContext
6
+ import com.facebook.react.bridge.ReactContextBaseJavaModule
7
+ import com.facebook.react.bridge.ReactMethod
8
+
9
+ class UNNavigationBarModule(reactContext: ReactApplicationContext) :
10
+ ReactContextBaseJavaModule(reactContext) {
11
+
12
+ @ReactMethod
13
+ fun isNavigationBarTranslucent(promise: Promise) {
14
+ val activity = currentActivity
15
+ if (activity == null) {
16
+ promise.resolve(false)
17
+ return
18
+ }
19
+
20
+ activity.runOnUiThread {
21
+ try {
22
+ @Suppress("DEPRECATION")
23
+ val flags = activity.window.attributes.flags
24
+ @Suppress("DEPRECATION")
25
+ val isTranslucent = (flags and WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION) != 0
26
+ promise.resolve(isTranslucent)
27
+ } catch (e: Exception) {
28
+ promise.resolve(false)
29
+ }
30
+ }
31
+ }
32
+
33
+ override fun getName() = MODULE_NAME
34
+
35
+ companion object {
36
+ const val MODULE_NAME = "UNNavigationBarModule"
37
+ }
38
+ }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.useSafeAreaDimensions = void 0;
7
7
  var _reactNative = require("react-native");
8
8
  var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
9
+ var _UNNavigationBarHelper = require("../nativeModulesHelpers/UNNavigationBarHelper");
9
10
  const isAndroid = _reactNative.Platform.OS === 'android';
10
11
  const isAndroid10To14 = isAndroid && _reactNative.Platform.Version >= 29 && _reactNative.Platform.Version < 35;
11
12
  const isAndroid15AndAbove = isAndroid && _reactNative.Platform.Version >= 35;
@@ -18,11 +19,19 @@ const insets = _reactNativeSafeAreaContext.initialWindowMetrics?.insets ?? {
18
19
  const windowHeight = _reactNative.Dimensions.get('window').height;
19
20
  const screenHeight = _reactNative.Dimensions.get('screen').height;
20
21
 
21
- // Detect edge-to-edge by comparing window to screen height
22
- // Edge-to-edge ON: windowHeight ≈ screenHeight | OFF: windowHeight < screenHeight
22
+ // Detect edge-to-edge on API 35+ by comparing window to screen height
23
23
  const heightDifference = Math.abs(screenHeight - windowHeight);
24
24
  const isEdgeToEdgeActive = isAndroid15AndAbove && heightDifference < 10;
25
- const effectiveBottomInset = isEdgeToEdgeActive ? insets.bottom : 0;
25
+
26
+ // Resolved once at module load time; defaults to false until resolved.
27
+ // The native call is fast (reads a window flag), so it resolves before
28
+ // any bottom sheet is opened.
29
+ let _navBarTranslucent = false;
30
+ if (isAndroid) {
31
+ (0, _UNNavigationBarHelper.isNavigationBarTranslucent)().then(result => {
32
+ _navBarTranslucent = result;
33
+ });
34
+ }
26
35
  const calculateFullScreenHeight = () => {
27
36
  if (isAndroid15AndAbove) {
28
37
  return isEdgeToEdgeActive ? screenHeight : windowHeight;
@@ -44,6 +53,8 @@ const calculateContentHeight = () => {
44
53
  };
45
54
  const contentHeight = calculateContentHeight();
46
55
  const useSafeAreaDimensions = () => {
56
+ const shouldApplyBottomInset = isEdgeToEdgeActive || _navBarTranslucent;
57
+ const effectiveBottomInset = shouldApplyBottomInset ? insets.bottom : 0;
47
58
  return {
48
59
  insets,
49
60
  fullScreenHeight,
@@ -1 +1 @@
1
- {"version":3,"names":["_reactNative","require","_reactNativeSafeAreaContext","isAndroid","Platform","OS","isAndroid10To14","Version","isAndroid15AndAbove","insets","initialWindowMetrics","top","bottom","left","right","windowHeight","Dimensions","get","height","screenHeight","heightDifference","Math","abs","isEdgeToEdgeActive","effectiveBottomInset","calculateFullScreenHeight","fullScreenHeight","calculateContentHeight","contentHeight","useSafeAreaDimensions","isAndroid10AndAbove","exports"],"sourceRoot":"../../../src","sources":["hooks/useSafeAreaDimensions.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AAEA,MAAME,SAAS,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMC,eAAe,GAAGH,SAAS,IAAIC,qBAAQ,CAACG,OAAO,IAAI,EAAE,IAAIH,qBAAQ,CAACG,OAAO,GAAG,EAAE;AACpF,MAAMC,mBAAmB,GAAGL,SAAS,IAAIC,qBAAQ,CAACG,OAAO,IAAI,EAAE;AAE/D,MAAME,MAAM,GAAGC,gDAAoB,EAAED,MAAM,IAAI;EAAEE,GAAG,EAAE,CAAC;EAAEC,MAAM,EAAE,CAAC;EAAEC,IAAI,EAAE,CAAC;EAAEC,KAAK,EAAE;AAAE,CAAC;AACvF,MAAMC,YAAY,GAAGC,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,MAAM;AACpD,MAAMC,YAAY,GAAGH,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,MAAM;;AAEpD;AACA;AACA,MAAME,gBAAgB,GAAGC,IAAI,CAACC,GAAG,CAACH,YAAY,GAAGJ,YAAY,CAAC;AAC9D,MAAMQ,kBAAkB,GAAGf,mBAAmB,IAAIY,gBAAgB,GAAG,EAAE;AAEvE,MAAMI,oBAAoB,GAAGD,kBAAkB,GAAGd,MAAM,CAACG,MAAM,GAAG,CAAC;AAEnE,MAAMa,yBAAyB,GAAGA,CAAA,KAAc;EAC9C,IAAIjB,mBAAmB,EAAE;IACvB,OAAOe,kBAAkB,GAAGJ,YAAY,GAAGJ,YAAY;EACzD,CAAC,MAAM,IAAIT,eAAe,EAAE;IAC1B;IACA,OAAOa,YAAY;EACrB;EACA,OAAOJ,YAAY;AACrB,CAAC;AAED,MAAMW,gBAAgB,GAAGD,yBAAyB,CAAC,CAAC;AAEpD,MAAME,sBAAsB,GAAGA,CAAA,KAAc;EAC3C,IAAInB,mBAAmB,IAAI,CAACe,kBAAkB,EAAE;IAC9C,OAAOR,YAAY;EACrB;EACA,IAAIT,eAAe,EAAE;IACnB,OAAOoB,gBAAgB,GAAGjB,MAAM,CAACE,GAAG,GAAGF,MAAM,CAACG,MAAM;EACtD;EACA,OAAOc,gBAAgB,GAAGjB,MAAM,CAACE,GAAG;AACtC,CAAC;AAED,MAAMiB,aAAa,GAAGD,sBAAsB,CAAC,CAAC;AAEvC,MAAME,qBAAqB,GAAGA,CAAA,KAAM;EACzC,OAAO;IACLpB,MAAM;IACNiB,gBAAgB;IAChBE,aAAa;IACbE,mBAAmB,EAAE3B,SAAS,IAAIC,qBAAQ,CAACG,OAAO,IAAI,EAAE;IACxDgB,kBAAkB;IAClBC;EACF,CAAC;AACH,CAAC;AAACO,OAAA,CAAAF,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_reactNative","require","_reactNativeSafeAreaContext","_UNNavigationBarHelper","isAndroid","Platform","OS","isAndroid10To14","Version","isAndroid15AndAbove","insets","initialWindowMetrics","top","bottom","left","right","windowHeight","Dimensions","get","height","screenHeight","heightDifference","Math","abs","isEdgeToEdgeActive","_navBarTranslucent","isNavigationBarTranslucent","then","result","calculateFullScreenHeight","fullScreenHeight","calculateContentHeight","contentHeight","useSafeAreaDimensions","shouldApplyBottomInset","effectiveBottomInset","isAndroid10AndAbove","exports"],"sourceRoot":"../../../src","sources":["hooks/useSafeAreaDimensions.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,2BAAA,GAAAD,OAAA;AACA,IAAAE,sBAAA,GAAAF,OAAA;AAEA,MAAMG,SAAS,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS;AAC3C,MAAMC,eAAe,GAAGH,SAAS,IAAIC,qBAAQ,CAACG,OAAO,IAAI,EAAE,IAAIH,qBAAQ,CAACG,OAAO,GAAG,EAAE;AACpF,MAAMC,mBAAmB,GAAGL,SAAS,IAAIC,qBAAQ,CAACG,OAAO,IAAI,EAAE;AAE/D,MAAME,MAAM,GAAGC,gDAAoB,EAAED,MAAM,IAAI;EAAEE,GAAG,EAAE,CAAC;EAAEC,MAAM,EAAE,CAAC;EAAEC,IAAI,EAAE,CAAC;EAAEC,KAAK,EAAE;AAAE,CAAC;AACvF,MAAMC,YAAY,GAAGC,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,MAAM;AACpD,MAAMC,YAAY,GAAGH,uBAAU,CAACC,GAAG,CAAC,QAAQ,CAAC,CAACC,MAAM;;AAEpD;AACA,MAAME,gBAAgB,GAAGC,IAAI,CAACC,GAAG,CAACH,YAAY,GAAGJ,YAAY,CAAC;AAC9D,MAAMQ,kBAAkB,GAAGf,mBAAmB,IAAIY,gBAAgB,GAAG,EAAE;;AAEvE;AACA;AACA;AACA,IAAII,kBAAkB,GAAG,KAAK;AAE9B,IAAIrB,SAAS,EAAE;EACb,IAAAsB,iDAA0B,EAAC,CAAC,CAACC,IAAI,CAAEC,MAAM,IAAK;IAC5CH,kBAAkB,GAAGG,MAAM;EAC7B,CAAC,CAAC;AACJ;AAEA,MAAMC,yBAAyB,GAAGA,CAAA,KAAc;EAC9C,IAAIpB,mBAAmB,EAAE;IACvB,OAAOe,kBAAkB,GAAGJ,YAAY,GAAGJ,YAAY;EACzD,CAAC,MAAM,IAAIT,eAAe,EAAE;IAC1B;IACA,OAAOa,YAAY;EACrB;EACA,OAAOJ,YAAY;AACrB,CAAC;AAED,MAAMc,gBAAgB,GAAGD,yBAAyB,CAAC,CAAC;AAEpD,MAAME,sBAAsB,GAAGA,CAAA,KAAc;EAC3C,IAAItB,mBAAmB,IAAI,CAACe,kBAAkB,EAAE;IAC9C,OAAOR,YAAY;EACrB;EACA,IAAIT,eAAe,EAAE;IACnB,OAAOuB,gBAAgB,GAAGpB,MAAM,CAACE,GAAG,GAAGF,MAAM,CAACG,MAAM;EACtD;EACA,OAAOiB,gBAAgB,GAAGpB,MAAM,CAACE,GAAG;AACtC,CAAC;AAED,MAAMoB,aAAa,GAAGD,sBAAsB,CAAC,CAAC;AAEvC,MAAME,qBAAqB,GAAGA,CAAA,KAAM;EACzC,MAAMC,sBAAsB,GAAGV,kBAAkB,IAAIC,kBAAkB;EACvE,MAAMU,oBAAoB,GAAGD,sBAAsB,GAAGxB,MAAM,CAACG,MAAM,GAAG,CAAC;EAEvE,OAAO;IACLH,MAAM;IACNoB,gBAAgB;IAChBE,aAAa;IACbI,mBAAmB,EAAEhC,SAAS,IAAIC,qBAAQ,CAACG,OAAO,IAAI,EAAE;IACxDgB,kBAAkB;IAClBW;EACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAAJ,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isNavigationBarTranslucent = isNavigationBarTranslucent;
7
+ var _reactNative = require("react-native");
8
+ const UNNavigationBarModule = _reactNative.Platform.OS === 'android' ? _reactNative.NativeModules.UNNavigationBarModule : undefined;
9
+ async function isNavigationBarTranslucent() {
10
+ if (!UNNavigationBarModule) return false;
11
+ try {
12
+ return await UNNavigationBarModule.isNavigationBarTranslucent();
13
+ } catch {
14
+ return false;
15
+ }
16
+ }
17
+ //# sourceMappingURL=UNNavigationBarHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","UNNavigationBarModule","Platform","OS","NativeModules","undefined","isNavigationBarTranslucent"],"sourceRoot":"../../../src","sources":["nativeModulesHelpers/UNNavigationBarHelper.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,qBAAqB,GAAGC,qBAAQ,CAACC,EAAE,KAAK,SAAS,GACnDC,0BAAa,CAACH,qBAAqB,GACnCI,SAAS;AAEN,eAAeC,0BAA0BA,CAAA,EAAqB;EACnE,IAAI,CAACL,qBAAqB,EAAE,OAAO,KAAK;EACxC,IAAI;IACF,OAAO,MAAMA,qBAAqB,CAACK,0BAA0B,CAAC,CAAC;EACjE,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF","ignoreList":[]}
@@ -21,7 +21,7 @@ var _UNFontFileHelper = require("../nativeModulesHelpers/UNFontFileHelper/UNFont
21
21
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
22
  class UnitComponentsSDK {
23
23
  static securitySettings = _UnitComponentsSdk2.UNComponentsSDKConstants.securitySettings;
24
- static sdkVersion = '3.1.2-beta.1';
24
+ static sdkVersion = '3.1.2-beta.2';
25
25
  static iosFontBase64Map = {};
26
26
  static init = async (env, theme, language, fonts, webVersioningStrategy = _UnitComponentsSdk2.UNComponentsSDKConstants.webSDKRecommendedStrategy, securitySettings = _UnitComponentsSdk2.UNComponentsSDKConstants.securitySettings) => {
27
27
  try {
@@ -1,5 +1,6 @@
1
1
  import { Dimensions, Platform } from 'react-native';
2
2
  import { initialWindowMetrics } from 'react-native-safe-area-context';
3
+ import { isNavigationBarTranslucent } from '../nativeModulesHelpers/UNNavigationBarHelper';
3
4
  const isAndroid = Platform.OS === 'android';
4
5
  const isAndroid10To14 = isAndroid && Platform.Version >= 29 && Platform.Version < 35;
5
6
  const isAndroid15AndAbove = isAndroid && Platform.Version >= 35;
@@ -12,11 +13,19 @@ const insets = initialWindowMetrics?.insets ?? {
12
13
  const windowHeight = Dimensions.get('window').height;
13
14
  const screenHeight = Dimensions.get('screen').height;
14
15
 
15
- // Detect edge-to-edge by comparing window to screen height
16
- // Edge-to-edge ON: windowHeight ≈ screenHeight | OFF: windowHeight < screenHeight
16
+ // Detect edge-to-edge on API 35+ by comparing window to screen height
17
17
  const heightDifference = Math.abs(screenHeight - windowHeight);
18
18
  const isEdgeToEdgeActive = isAndroid15AndAbove && heightDifference < 10;
19
- const effectiveBottomInset = isEdgeToEdgeActive ? insets.bottom : 0;
19
+
20
+ // Resolved once at module load time; defaults to false until resolved.
21
+ // The native call is fast (reads a window flag), so it resolves before
22
+ // any bottom sheet is opened.
23
+ let _navBarTranslucent = false;
24
+ if (isAndroid) {
25
+ isNavigationBarTranslucent().then(result => {
26
+ _navBarTranslucent = result;
27
+ });
28
+ }
20
29
  const calculateFullScreenHeight = () => {
21
30
  if (isAndroid15AndAbove) {
22
31
  return isEdgeToEdgeActive ? screenHeight : windowHeight;
@@ -38,6 +47,8 @@ const calculateContentHeight = () => {
38
47
  };
39
48
  const contentHeight = calculateContentHeight();
40
49
  export const useSafeAreaDimensions = () => {
50
+ const shouldApplyBottomInset = isEdgeToEdgeActive || _navBarTranslucent;
51
+ const effectiveBottomInset = shouldApplyBottomInset ? insets.bottom : 0;
41
52
  return {
42
53
  insets,
43
54
  fullScreenHeight,
@@ -1 +1 @@
1
- {"version":3,"names":["Dimensions","Platform","initialWindowMetrics","isAndroid","OS","isAndroid10To14","Version","isAndroid15AndAbove","insets","top","bottom","left","right","windowHeight","get","height","screenHeight","heightDifference","Math","abs","isEdgeToEdgeActive","effectiveBottomInset","calculateFullScreenHeight","fullScreenHeight","calculateContentHeight","contentHeight","useSafeAreaDimensions","is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A,CAAA,KAAc;EAC3C,IAAIjB,mBAAmB,IAAI,CAACa,kBAAkB,EAAE;IAC9C,OAAOP,YAAY;EACrB;EACA,IAAIR,eAAe,EAAE;IACnB,OAAOkB,gBAAgB,GAAGf,MAAM,CAACC,GAAG,GAAGD,MAAM,CAACE,MAAM;EACtD;EACA,OAAOa,gBAAgB,GAAGf,MAAM,CAACC,GAAG;AACtC,CAAC;AAED,MAAMgB,aAAa,GAAGD,sBAAsB,CAAC,CAAC;AAE9C,OAAO,MAAME,qBAAqB,GAAGA,CAAA,KAAM;EACzC,OAAO;IACLlB,MAAM;IACNe,gBAAgB;IAChBE,aAAa;IACbE,mBAAmB,EAAExB,SAAS,IAAIF,QAAQ,CAACK,OAAO,IAAI,EAAE;IACxDc,kBAAkB;IAClBC;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["Dimensions","Platform","initialWindowMetrics","isNavigationBarTranslucent","isAndroid","OS","isAndroid10To14","Version","isAndroid15AndAbove","insets","top","bottom","left","right","windowHeight","get","height","screenHeight","heightDifference","Math","abs","isEdgeToEdgeActive","_navBarTranslucent","then","result","calculateFullScreenHeight","fullScreenHeight","calculateContentHeight","contentHeight","useSafeAreaDimensions","shouldApplyBottomInset","effectiveBottomInset","isAndroid10AndAbove"],"sourceRoot":"../../../src","sources":["hooks/useSafeAreaDimensions.ts"],"mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,cAAc;AACnD,SAASC,oBAAoB,QAAQ,gCAAgC;AACrE,SAASC,0BAA0B,QAAQ,+CAA+C;AAE1F,MAAMC,SAAS,GAAGH,QAAQ,CAACI,EAAE,KAAK,SAAS;AAC3C,MAAMC,eAAe,GAAGF,SAAS,IAAIH,QAAQ,CAACM,OAAO,IAAI,EAAE,IAAIN,QAAQ,CAACM,OAAO,GAAG,EAAE;AACpF,MAAMC,mBAAmB,GAAGJ,SAAS,IAAIH,QAAQ,CAACM,OAAO,IAAI,EAAE;AAE/D,MAAME,MAA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;AAE9C,OAAO,MAAME,qBAAqB,GAAGA,CAAA,KAAM;EACzC,MAAMC,sBAAsB,GAAGT,kBAAkB,IAAIC,kBAAkB;EACvE,MAAMS,oBAAoB,GAAGD,sBAAsB,GAAGrB,MAAM,CAACE,MAAM,GAAG,CAAC;EAEvE,OAAO;IACLF,MAAM;IACNiB,gBAAgB;IAChBE,aAAa;IACbI,mBAAmB,EAAE5B,SAAS,IAAIH,QAAQ,CAACM,OAAO,IAAI,EAAE;IACxDc,kBAAkB;IAClBU;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import { Platform, NativeModules } from 'react-native';
2
+ const UNNavigationBarModule = Platform.OS === 'android' ? NativeModules.UNNavigationBarModule : undefined;
3
+ export async function isNavigationBarTranslucent() {
4
+ if (!UNNavigationBarModule) return false;
5
+ try {
6
+ return await UNNavigationBarModule.isNavigationBarTranslucent();
7
+ } catch {
8
+ return false;
9
+ }
10
+ }
11
+ //# sourceMappingURL=UNNavigationBarHelper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Platform","NativeModules","UNNavigationBarModule","OS","undefined","isNavigationBarTranslucent"],"sourceRoot":"../../../src","sources":["nativeModulesHelpers/UNNavigationBarHelper.ts"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,aAAa,QAAQ,cAAc;AAEtD,MAAMC,qBAAqB,GAAGF,QAAQ,CAACG,EAAE,KAAK,SAAS,GACnDF,aAAa,CAACC,qBAAqB,GACnCE,SAAS;AAEb,OAAO,eAAeC,0BAA0BA,CAAA,EAAqB;EACnE,IAAI,CAACH,qBAAqB,EAAE,OAAO,KAAK;EACxC,IAAI;IACF,OAAO,MAAMA,qBAAqB,CAACG,0BAA0B,CAAC,CAAC;EACjE,CAAC,CAAC,MAAM;IACN,OAAO,KAAK;EACd;AACF","ignoreList":[]}
@@ -14,7 +14,7 @@ import UNSnapshotProtectionHelper from '../nativeModulesHelpers/UNSanpshotProtec
14
14
  import { loadIosFontBase64 } from '../nativeModulesHelpers/UNFontFileHelper/UNFontFileHelper';
15
15
  export class UnitComponentsSDK {
16
16
  static securitySettings = UNComponentsSDKConstants.securitySettings;
17
- static sdkVersion = '3.1.2-beta.1';
17
+ static sdkVersion = '3.1.2-beta.2';
18
18
  static iosFontBase64Map = {};
19
19
  static init = async (env, theme, language, fonts, webVersioningStrategy = UNComponentsSDKConstants.webSDKRecommendedStrategy, securitySettings = UNComponentsSDKConstants.securitySettings) => {
20
20
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"useSafeAreaDimensions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSafeAreaDimensions.ts"],"names":[],"mappings":"AA0CA,eAAO,MAAM,qBAAqB;;;;;;;CASjC,CAAC"}
1
+ {"version":3,"file":"useSafeAreaDimensions.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSafeAreaDimensions.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,qBAAqB;;;;;;;CAYjC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function isNavigationBarTranslucent(): Promise<boolean>;
2
+ //# sourceMappingURL=UNNavigationBarHelper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UNNavigationBarHelper.d.ts","sourceRoot":"","sources":["../../../../src/nativeModulesHelpers/UNNavigationBarHelper.ts"],"names":[],"mappings":"AAMA,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,OAAO,CAAC,CAOnE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-unit-components",
3
- "version": "3.1.2-beta.1",
3
+ "version": "3.1.2-beta.2",
4
4
  "description": "Unit React Native components",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,5 +1,6 @@
1
1
  import { Dimensions, Platform } from 'react-native';
2
2
  import { initialWindowMetrics } from 'react-native-safe-area-context';
3
+ import { isNavigationBarTranslucent } from '../nativeModulesHelpers/UNNavigationBarHelper';
3
4
 
4
5
  const isAndroid = Platform.OS === 'android';
5
6
  const isAndroid10To14 = isAndroid && Platform.Version >= 29 && Platform.Version < 35;
@@ -9,12 +10,20 @@ const insets = initialWindowMetrics?.insets ?? { top: 0, bottom: 0, left: 0, rig
9
10
  const windowHeight = Dimensions.get('window').height;
10
11
  const screenHeight = Dimensions.get('screen').height;
11
12
 
12
- // Detect edge-to-edge by comparing window to screen height
13
- // Edge-to-edge ON: windowHeight ≈ screenHeight | OFF: windowHeight < screenHeight
13
+ // Detect edge-to-edge on API 35+ by comparing window to screen height
14
14
  const heightDifference = Math.abs(screenHeight - windowHeight);
15
15
  const isEdgeToEdgeActive = isAndroid15AndAbove && heightDifference < 10;
16
16
 
17
- const effectiveBottomInset = isEdgeToEdgeActive ? insets.bottom : 0;
17
+ // Resolved once at module load time; defaults to false until resolved.
18
+ // The native call is fast (reads a window flag), so it resolves before
19
+ // any bottom sheet is opened.
20
+ let _navBarTranslucent = false;
21
+
22
+ if (isAndroid) {
23
+ isNavigationBarTranslucent().then((result) => {
24
+ _navBarTranslucent = result;
25
+ });
26
+ }
18
27
 
19
28
  const calculateFullScreenHeight = (): number => {
20
29
  if (isAndroid15AndAbove) {
@@ -41,6 +50,9 @@ const calculateContentHeight = (): number => {
41
50
  const contentHeight = calculateContentHeight();
42
51
 
43
52
  export const useSafeAreaDimensions = () => {
53
+ const shouldApplyBottomInset = isEdgeToEdgeActive || _navBarTranslucent;
54
+ const effectiveBottomInset = shouldApplyBottomInset ? insets.bottom : 0;
55
+
44
56
  return {
45
57
  insets,
46
58
  fullScreenHeight,
@@ -0,0 +1,14 @@
1
+ import { Platform, NativeModules } from 'react-native';
2
+
3
+ const UNNavigationBarModule = Platform.OS === 'android'
4
+ ? NativeModules.UNNavigationBarModule
5
+ : undefined;
6
+
7
+ export async function isNavigationBarTranslucent(): Promise<boolean> {
8
+ if (!UNNavigationBarModule) return false;
9
+ try {
10
+ return await UNNavigationBarModule.isNavigationBarTranslucent();
11
+ } catch {
12
+ return false;
13
+ }
14
+ }
@@ -26,7 +26,7 @@ export class UnitComponentsSDK {
26
26
  protected static fonts?: UNFonts;
27
27
  protected static signedNonce?: string;
28
28
  protected static pushProvisionModule?: typeof NativeModules;
29
- protected static sdkVersion = '3.1.2-beta.1';
29
+ protected static sdkVersion = '3.1.2-beta.2';
30
30
  static iosFontBase64Map: Record<string, string> = {};
31
31
 
32
32
  public static init = async (