react-native-ui-lib 7.44.0-snapshot.7249 → 7.45.0-snapshot.7253

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.
Files changed (195) hide show
  1. package/babel.config.js +12 -0
  2. package/index.js +1 -0
  3. package/lib/android/build.gradle +5 -5
  4. package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +0 -2
  5. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +31 -23
  6. package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +1 -1
  7. package/lib/components/{HighlighterOverlayView.d.ts → HighlighterOverlayView/index.d.ts} +1 -1
  8. package/lib/components/HighlighterOverlayView/index.js +49 -0
  9. package/lib/components/{HighlighterOverlayView.web.d.ts → HighlighterOverlayView/index.web.d.ts} +1 -1
  10. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.android.d.ts +5 -2
  11. package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +51 -0
  12. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.d.ts +1 -1
  13. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.js +3 -3
  14. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.d.ts +3 -0
  15. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.js +1 -1
  16. package/lib/components/Keyboard/{KeyboardInput/utils → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager}/__tests__/EventEmitterManager.spec.js +1 -1
  17. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/__tests__/KeyboardRegistry.spec.js +1 -1
  18. package/lib/components/Keyboard/{KeyboardInput/KeyboardRegistry.d.ts → KeyboardAccessoryView/KeyboardRegistry/index.d.ts} +1 -1
  19. package/lib/components/Keyboard/{KeyboardInput/KeyboardRegistry.js → KeyboardAccessoryView/KeyboardRegistry/index.js} +1 -1
  20. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/keyboardRegistry.api.json +9 -9
  21. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +26 -0
  22. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +91 -0
  23. package/lib/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.d.ts → KeyboardAccessoryView/index.d.ts} +11 -1
  24. package/lib/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.js → KeyboardAccessoryView/index.js} +31 -5
  25. package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/keyboardAccessoryView.api.json +5 -5
  26. package/lib/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.d.ts → KeyboardAwareInsetsView/index.d.ts} +1 -1
  27. package/lib/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.js → KeyboardAwareInsetsView/index.js} +1 -1
  28. package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.d.ts +1 -4
  29. package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.js +5 -8
  30. package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.d.ts +2 -2
  31. package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/keyboardTrackingView.api.json +11 -20
  32. package/lib/components/Keyboard/index.d.ts +6 -6
  33. package/lib/components/Keyboard/index.js +6 -6
  34. package/lib/components/SafeArea/SafeAreaInsetsManager.d.ts +15 -7
  35. package/lib/components/SafeArea/SafeAreaInsetsManager.js +91 -28
  36. package/lib/components/SafeArea/SafeAreaSpacerView.d.ts +2 -2
  37. package/lib/components/SafeArea/SafeAreaSpacerView.js +63 -9
  38. package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +271 -0
  39. package/lib/components/SafeArea/index.d.ts +10 -0
  40. package/lib/components/SafeArea/index.js +11 -0
  41. package/lib/components/index.d.ts +1 -1
  42. package/lib/components/index.js +1 -1
  43. package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +45 -32
  44. package/lib/package.json +1 -1
  45. package/lib/react-native.config.js +1 -3
  46. package/metro.config.js +2 -2
  47. package/package.json +24 -24
  48. package/panView.d.ts +2 -0
  49. package/panView.js +1 -0
  50. package/react-native.config.js +1 -3
  51. package/src/commons/Constants.js +2 -5
  52. package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +5 -1
  53. package/src/components/actionSheet/index.d.ts +2 -12
  54. package/src/components/actionSheet/index.js +3 -42
  55. package/src/components/avatar/index.js +1 -1
  56. package/src/components/badge/index.d.ts +107 -47
  57. package/src/components/button/button.api.json +1 -1
  58. package/src/components/button/index.d.ts +53 -23
  59. package/src/components/button/types.d.ts +0 -1
  60. package/src/components/carousel/index.js +1 -6
  61. package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
  62. package/src/components/colorPicker/ColorPickerDialog.js +1 -1
  63. package/src/components/dateTimePicker/index.d.ts +186 -5
  64. package/src/components/dateTimePicker/index.js +1 -2
  65. package/src/components/dialog/dialog.api.json +31 -37
  66. package/src/{incubator → components}/dialog/dialogHeader.api.json +2 -2
  67. package/src/components/dialog/index.d.ts +13 -105
  68. package/src/components/dialog/index.js +204 -212
  69. package/src/{incubator → components}/dialog/types.d.ts +0 -19
  70. package/src/{incubator → components}/dialog/types.js +1 -3
  71. package/src/{incubator → components}/dialog/useDialogContent.d.ts +1 -1
  72. package/src/components/drawer/Swipeable.js +1 -2
  73. package/src/components/drawer/index.js +31 -25
  74. package/src/components/fadedScrollView/index.js +7 -2
  75. package/src/components/featureHighlight/index.d.ts +1 -1
  76. package/src/components/index.js +0 -19
  77. package/src/components/modal/index.d.ts +5 -0
  78. package/src/components/modal/index.js +14 -10
  79. package/src/components/modal/modal.api.json +5 -0
  80. package/src/{incubator → components}/panView/index.d.ts +3 -3
  81. package/src/{incubator → components}/panView/index.js +4 -4
  82. package/src/{incubator → components}/panView/usePanGesture.d.ts +1 -1
  83. package/src/components/picker/Picker.driver.new.d.ts +2 -2
  84. package/src/components/picker/Picker.driver.new.js +3 -3
  85. package/src/components/picker/PickerItem.js +6 -20
  86. package/src/components/picker/PickerPresenter.d.ts +0 -1
  87. package/src/components/picker/PickerPresenter.js +1 -23
  88. package/src/components/picker/api/picker.api.json +0 -1
  89. package/src/components/picker/api/pickerItem.api.json +0 -5
  90. package/src/components/picker/helpers/useFieldType.d.ts +53 -23
  91. package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
  92. package/src/components/picker/helpers/usePickerLabel.js +2 -3
  93. package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
  94. package/src/components/picker/helpers/usePickerMigrationWarnings.js +0 -12
  95. package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
  96. package/src/components/picker/helpers/usePickerSearch.js +4 -8
  97. package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
  98. package/src/components/picker/helpers/usePickerSelection.js +2 -10
  99. package/src/components/picker/index.js +4 -22
  100. package/src/components/picker/types.d.ts +1 -24
  101. package/src/components/segmentedControl/index.js +3 -3
  102. package/src/components/slider/GradientSlider.d.ts +1 -1
  103. package/src/components/sortableGridList/SortableItem.js +13 -4
  104. package/src/components/sortableList/SortableListItem.js +13 -4
  105. package/src/components/stackAggregator/index.js +16 -11
  106. package/src/components/textField/Input.js +0 -1
  107. package/src/components/textField/TextField.driver.new.d.ts +2 -2
  108. package/src/components/textField/TextField.driver.new.js +2 -2
  109. package/src/components/textField/presets/outline.d.ts +106 -46
  110. package/src/components/textField/presets/underline.d.ts +106 -46
  111. package/src/components/textField/usePreset.d.ts +72 -44
  112. package/src/{incubator/hooks/useHiddenLocation.web.d.ts → hooks/useHiddenLocation/index.d.ts} +1 -1
  113. package/src/{incubator/hooks/useHiddenLocation.d.ts → hooks/useHiddenLocation/index.web.d.ts} +1 -1
  114. package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
  115. package/src/incubator/expandableOverlay/index.d.ts +42 -3
  116. package/src/incubator/expandableOverlay/index.js +1 -4
  117. package/src/incubator/index.d.ts +0 -2
  118. package/src/incubator/index.js +0 -2
  119. package/src/incubator/toast/index.js +1 -1
  120. package/src/index.d.ts +3 -10
  121. package/src/index.js +41 -160
  122. package/src/testkit/index.d.ts +1 -1
  123. package/src/testkit/index.js +1 -1
  124. package/src/testkit/new/Component.driver.d.ts +4 -1
  125. package/src/testkit/new/Component.driver.js +3 -3
  126. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReactHacks.java +0 -30
  127. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java +0 -34
  128. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java +0 -33
  129. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/KeyListenerProxy.java +0 -53
  130. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.java +0 -54
  131. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.java +0 -28
  132. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/ViewUtils.java +0 -36
  133. package/lib/components/HighlighterOverlayView.js +0 -40
  134. package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +0 -28
  135. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +0 -11
  136. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.js +0 -17
  137. package/panningViews.d.ts +0 -2
  138. package/panningViews.js +0 -1
  139. package/sharedTransition.d.ts +0 -2
  140. package/sharedTransition.js +0 -1
  141. package/src/components/dialog/DialogDismissibleView.d.ts +0 -34
  142. package/src/components/dialog/DialogDismissibleView.js +0 -184
  143. package/src/components/dialog/OverlayFadingBackground.d.ts +0 -14
  144. package/src/components/dialog/OverlayFadingBackground.js +0 -45
  145. package/src/components/panningViews/asPanViewConsumer.d.ts +0 -3
  146. package/src/components/panningViews/asPanViewConsumer.js +0 -16
  147. package/src/components/panningViews/panDismissibleView.d.ts +0 -51
  148. package/src/components/panningViews/panDismissibleView.js +0 -350
  149. package/src/components/panningViews/panGestureView.d.ts +0 -23
  150. package/src/components/panningViews/panGestureView.js +0 -156
  151. package/src/components/panningViews/panListenerView.d.ts +0 -66
  152. package/src/components/panningViews/panListenerView.js +0 -155
  153. package/src/components/panningViews/panResponderView.d.ts +0 -19
  154. package/src/components/panningViews/panResponderView.js +0 -79
  155. package/src/components/panningViews/panningContext.d.ts +0 -3
  156. package/src/components/panningViews/panningContext.js +0 -4
  157. package/src/components/panningViews/panningProvider.d.ts +0 -73
  158. package/src/components/panningViews/panningProvider.js +0 -101
  159. package/src/components/sharedTransition/ShareTransitionContext.js +0 -3
  160. package/src/components/sharedTransition/SharedArea.js +0 -153
  161. package/src/components/sharedTransition/SourceElement.js +0 -44
  162. package/src/components/sharedTransition/TargetElement.js +0 -38
  163. package/src/components/sharedTransition/index.js +0 -9
  164. package/src/incubator/dialog/dialog.api.json +0 -54
  165. package/src/incubator/dialog/index.d.ts +0 -15
  166. package/src/incubator/dialog/index.js +0 -218
  167. /package/lib/components/{HighlighterOverlayView.web.js → HighlighterOverlayView/index.web.js} +0 -0
  168. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.d.ts +0 -0
  169. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.js +0 -0
  170. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.d.ts +0 -0
  171. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.js +0 -0
  172. /package/lib/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.d.ts → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts} +0 -0
  173. /package/lib/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.js → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js} +0 -0
  174. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
  175. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
  176. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
  177. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
  178. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.d.ts +0 -0
  179. /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.js +0 -0
  180. /package/lib/components/Keyboard/{KeyboardTracking → KeyboardAwareInsetsView}/keyboardAwareInsetsView.api.json +0 -0
  181. /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
  182. /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
  183. /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.js +0 -0
  184. /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.d.ts +0 -0
  185. /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.js +0 -0
  186. /package/src/{incubator → components}/dialog/Dialog.driver.new.d.ts +0 -0
  187. /package/src/{incubator → components}/dialog/Dialog.driver.new.js +0 -0
  188. /package/src/{incubator → components}/dialog/DialogHeader.d.ts +0 -0
  189. /package/src/{incubator → components}/dialog/DialogHeader.js +0 -0
  190. /package/src/{incubator → components}/dialog/useDialogContent.js +0 -0
  191. /package/src/{incubator → components}/panView/panningUtil.d.ts +0 -0
  192. /package/src/{incubator → components}/panView/panningUtil.js +0 -0
  193. /package/src/{incubator → components}/panView/usePanGesture.js +0 -0
  194. /package/src/{incubator/hooks/useHiddenLocation.js → hooks/useHiddenLocation/index.js} +0 -0
  195. /package/src/{incubator/hooks/useHiddenLocation.web.js → hooks/useHiddenLocation/index.web.js} +0 -0
@@ -0,0 +1,271 @@
1
+ import {NativeModules, DeviceEventEmitter} from 'react-native';
2
+
3
+ describe('SafeAreaInsetsManager', () => {
4
+ beforeEach(() => {
5
+ // Reset mocks
6
+ jest.clearAllMocks();
7
+
8
+ // Reset the SafeAreaInsetsCache by creating a fresh instance
9
+ jest.resetModules();
10
+
11
+ // Spy on console methods to verify logging
12
+ jest.spyOn(console, 'log').mockImplementation(() => {});
13
+ jest.spyOn(console, 'warn').mockImplementation(() => {});
14
+ });
15
+
16
+ afterEach(() => {
17
+ // Restore console methods
18
+ jest.restoreAllMocks();
19
+ });
20
+
21
+ describe('getSafeAreaInsets', () => {
22
+ it('should return default insets when native module is not available', async () => {
23
+ // Arrange
24
+ NativeModules.SafeAreaManager = null;
25
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
26
+
27
+ // Act
28
+ const result = await SafeAreaInsetsManager.getSafeAreaInsets();
29
+
30
+ // Assert
31
+ expect(result).toEqual({top: 47, left: 0, bottom: 34, right: 0});
32
+ expect(console.log).toHaveBeenCalledWith('SafeAreaInsetsManager: Native SafeAreaManager not available, using defaults');
33
+ });
34
+
35
+ it('should return insets from native module when available', async () => {
36
+ // Arrange
37
+ const mockInsets = {top: 50, left: 10, bottom: 30, right: 10};
38
+ NativeModules.SafeAreaManager = {
39
+ getSafeAreaInsets: jest.fn().mockResolvedValue(mockInsets)
40
+ };
41
+
42
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
43
+
44
+ // Act
45
+ const result = await SafeAreaInsetsManager.getSafeAreaInsets();
46
+
47
+ // Assert
48
+ expect(result).toEqual(mockInsets);
49
+ expect(NativeModules.SafeAreaManager.getSafeAreaInsets).toHaveBeenCalled();
50
+ });
51
+
52
+ it.skip('should return cached insets on subsequent calls', async () => {
53
+ // Arrange
54
+ const mockInsets = {top: 44, left: 0, bottom: 34, right: 0};
55
+ NativeModules.SafeAreaManager = {
56
+ getSafeAreaInsets: jest.fn().mockResolvedValue(mockInsets)
57
+ };
58
+
59
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
60
+
61
+ // Act
62
+ const result1 = await SafeAreaInsetsManager.getSafeAreaInsets();
63
+ const result2 = await SafeAreaInsetsManager.getSafeAreaInsets();
64
+
65
+ // Assert
66
+ expect(result1).toEqual(mockInsets);
67
+ expect(result2).toEqual(mockInsets);
68
+ expect(NativeModules.SafeAreaManager.getSafeAreaInsets).toHaveBeenCalledTimes(1); // Should only call native once due to caching
69
+ });
70
+
71
+ it('should handle native module errors gracefully', async () => {
72
+ // Arrange
73
+ const mockError = new Error('Native module error');
74
+ NativeModules.SafeAreaManager = {
75
+ getSafeAreaInsets: jest.fn().mockRejectedValue(mockError)
76
+ };
77
+
78
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
79
+
80
+ // Act
81
+ const result = await SafeAreaInsetsManager.getSafeAreaInsets();
82
+
83
+ // Assert
84
+ expect(result).toEqual({top: 47, left: 0, bottom: 34, right: 0}); // Should fallback to defaults
85
+ expect(console.warn).toHaveBeenCalledWith('SafeAreaInsetsManager: Failed to get initial insets:', mockError);
86
+ expect(console.warn).toHaveBeenCalledWith('SafeAreaInsetsManager: Failed to get native insets:', mockError);
87
+ });
88
+
89
+ it('should handle native module setup errors gracefully', async () => {
90
+ // Arrange
91
+ Object.defineProperty(NativeModules, 'SafeAreaManager', {
92
+ get: () => {
93
+ throw new Error('Setup error');
94
+ }
95
+ });
96
+
97
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
98
+
99
+ // Act
100
+ const result = await SafeAreaInsetsManager.getSafeAreaInsets();
101
+
102
+ // Assert
103
+ expect(result).toEqual({top: 47, left: 0, bottom: 34, right: 0}); // Should fallback to defaults
104
+ expect(console.warn).toHaveBeenCalledWith('SafeAreaInsetsManager: Failed to connect to native module:', expect.any(Error));
105
+ });
106
+
107
+ it('should update insets when they change during the test', async () => {
108
+ // Arrange
109
+ const initialInsets = {top: 44, left: 0, bottom: 34, right: 0};
110
+ const updatedInsets = {top: 50, left: 0, bottom: 40, right: 0};
111
+
112
+ NativeModules.SafeAreaManager = {
113
+ // TODO: this will need to be changed when the we get caching to work in tests ("should return cached insets on subsequent calls")
114
+ // getSafeAreaInsets: jest.fn().mockResolvedValueOnce(initialInsets).mockResolvedValueOnce(updatedInsets)
115
+ getSafeAreaInsets: jest
116
+ .fn()
117
+ .mockResolvedValueOnce(initialInsets)
118
+ .mockResolvedValueOnce(initialInsets)
119
+ .mockResolvedValueOnce(updatedInsets)
120
+ };
121
+
122
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
123
+
124
+ // Act & Assert - Initial insets
125
+ const result1 = await SafeAreaInsetsManager.getSafeAreaInsets();
126
+ expect(result1).toEqual(initialInsets);
127
+
128
+ // Force refresh of insets
129
+ await SafeAreaInsetsManager.refreshSafeAreaInsets();
130
+
131
+ // Simulate insets change event from native side
132
+ DeviceEventEmitter.emit('SafeAreaInsetsDidChangeEvent', updatedInsets);
133
+
134
+ // Get insets again - should reflect the change
135
+ const result2 = await SafeAreaInsetsManager.getSafeAreaInsets();
136
+ expect(result2).toEqual(updatedInsets);
137
+ });
138
+
139
+ it('should notify delegates when insets change during the test', async () => {
140
+ // Arrange
141
+ const initialInsets = {top: 44, left: 0, bottom: 34, right: 0};
142
+ const updatedInsets = {top: 50, left: 0, bottom: 40, right: 0};
143
+
144
+ NativeModules.SafeAreaManager = {
145
+ getSafeAreaInsets: jest.fn().mockResolvedValue(initialInsets)
146
+ };
147
+
148
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
149
+
150
+ // Add a mock delegate
151
+ const mockDelegate = {
152
+ onSafeAreaInsetsDidChangeEvent: jest.fn()
153
+ };
154
+ SafeAreaInsetsManager.addSafeAreaChangedDelegate(mockDelegate);
155
+
156
+ // Act - Get initial insets
157
+ await SafeAreaInsetsManager.getSafeAreaInsets();
158
+
159
+ // Simulate insets change event from native side
160
+ DeviceEventEmitter.emit('SafeAreaInsetsDidChangeEvent', updatedInsets);
161
+
162
+ // Assert - Delegate should be notified
163
+ expect(mockDelegate.onSafeAreaInsetsDidChangeEvent).toHaveBeenCalledWith(updatedInsets);
164
+ });
165
+
166
+ it('should handle refreshSafeAreaInsets correctly', async () => {
167
+ // Arrange
168
+ const initialInsets = {top: 44, left: 0, bottom: 34, right: 0};
169
+ const refreshedInsets = {top: 48, left: 0, bottom: 36, right: 0};
170
+
171
+ NativeModules.SafeAreaManager = {
172
+ // TODO: this will need to be changed when the we get caching to work in tests ("should return cached insets on subsequent calls")
173
+ // getSafeAreaInsets: jest.fn().mockResolvedValueOnce(initialInsets).mockResolvedValueOnce(updatedInsets)
174
+ getSafeAreaInsets: jest
175
+ .fn()
176
+ .mockResolvedValueOnce(initialInsets)
177
+ .mockResolvedValueOnce(initialInsets)
178
+ .mockResolvedValueOnce(refreshedInsets)
179
+ };
180
+
181
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
182
+
183
+ // Act
184
+ const result1 = await SafeAreaInsetsManager.getSafeAreaInsets();
185
+ expect(result1).toEqual(initialInsets);
186
+
187
+ // Refresh insets
188
+ await SafeAreaInsetsManager.refreshSafeAreaInsets();
189
+
190
+ const result2 = await SafeAreaInsetsManager.getSafeAreaInsets();
191
+
192
+ // Assert
193
+ expect(result2).toEqual(refreshedInsets);
194
+ // TODO: this will need to be changed when the we get caching to work in tests ("should return cached insets on subsequent calls")
195
+ expect(NativeModules.SafeAreaManager.getSafeAreaInsets).toHaveBeenCalledTimes(3);
196
+ });
197
+
198
+ it('should not notify delegates when insets remain the same after refresh', async () => {
199
+ // Arrange
200
+ const sameInsets = {top: 44, left: 0, bottom: 34, right: 0};
201
+
202
+ NativeModules.SafeAreaManager = {
203
+ getSafeAreaInsets: jest.fn().mockResolvedValue(sameInsets)
204
+ };
205
+
206
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
207
+
208
+ // Add a mock delegate
209
+ const mockDelegate = {
210
+ onSafeAreaInsetsDidChangeEvent: jest.fn()
211
+ };
212
+ SafeAreaInsetsManager.addSafeAreaChangedDelegate(mockDelegate);
213
+
214
+ // Act
215
+ await SafeAreaInsetsManager.getSafeAreaInsets();
216
+ await SafeAreaInsetsManager.refreshSafeAreaInsets();
217
+
218
+ // TODO: this will need to be changed when the we get caching to work in tests ("should return cached insets on subsequent calls")
219
+ expect(NativeModules.SafeAreaManager.getSafeAreaInsets).toHaveBeenCalledTimes(3);
220
+
221
+ // Assert - Delegate should not be notified since insets didn't change
222
+ expect(mockDelegate.onSafeAreaInsetsDidChangeEvent).not.toHaveBeenCalled();
223
+ });
224
+
225
+ it('should return default insets when native getSafeAreaInsets returns null', async () => {
226
+ // Arrange
227
+ NativeModules.SafeAreaManager = {
228
+ getSafeAreaInsets: jest.fn().mockResolvedValue(null)
229
+ };
230
+
231
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
232
+
233
+ // Act
234
+ const result = await SafeAreaInsetsManager.getSafeAreaInsets();
235
+
236
+ // Assert
237
+ expect(result).toEqual({top: 47, left: 0, bottom: 34, right: 0});
238
+ });
239
+
240
+ it('should properly manage delegate lifecycle', async () => {
241
+ // Arrange
242
+ NativeModules.SafeAreaManager = {
243
+ getSafeAreaInsets: jest.fn().mockResolvedValue({top: 44, left: 0, bottom: 34, right: 0})
244
+ };
245
+
246
+ const SafeAreaInsetsManager = require('../SafeAreaInsetsManager').default;
247
+
248
+ const mockDelegate1 = {
249
+ onSafeAreaInsetsDidChangeEvent: jest.fn()
250
+ };
251
+ const mockDelegate2 = {
252
+ onSafeAreaInsetsDidChangeEvent: jest.fn()
253
+ };
254
+
255
+ // Act
256
+ SafeAreaInsetsManager.addSafeAreaChangedDelegate(mockDelegate1);
257
+ SafeAreaInsetsManager.addSafeAreaChangedDelegate(mockDelegate2);
258
+
259
+ // Remove one delegate
260
+ SafeAreaInsetsManager.removeSafeAreaChangedDelegate(mockDelegate1);
261
+
262
+ // Trigger notification
263
+ const newInsets = {top: 50, left: 0, bottom: 40, right: 0};
264
+ SafeAreaInsetsManager.notifyDelegates(newInsets);
265
+
266
+ // Assert
267
+ expect(mockDelegate1.onSafeAreaInsetsDidChangeEvent).not.toHaveBeenCalled();
268
+ expect(mockDelegate2.onSafeAreaInsetsDidChangeEvent).toHaveBeenCalledWith(newInsets);
269
+ });
270
+ });
271
+ });
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { ViewStyle, StyleProp } from 'react-native';
3
+ export type SafeAreaSpacerViewProps = {
4
+ style?: StyleProp<ViewStyle>;
5
+ };
6
+ declare const SafeAreaSpacerView: {
7
+ ({ style }: SafeAreaSpacerViewProps): React.JSX.Element;
8
+ displayName: string;
9
+ };
10
+ export default SafeAreaSpacerView;
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import { View, Platform } from 'react-native';
3
+ import SafeAreaSpacerViewIos from "./SafeAreaSpacerView";
4
+ const isIOS = Platform.OS === 'ios';
5
+ const SafeAreaSpacerView = ({
6
+ style
7
+ }) => {
8
+ return isIOS ? <SafeAreaSpacerViewIos style={style} /> : <View style={style} />;
9
+ };
10
+ SafeAreaSpacerView.displayName = 'SafeAreaSpacerView';
11
+ export default SafeAreaSpacerView;
@@ -1,6 +1,6 @@
1
1
  import DynamicFonts, { FontExtension } from './DynamicFonts';
2
2
  import HighlighterOverlayView from './HighlighterOverlayView';
3
- import SafeAreaSpacerView from './SafeArea/SafeAreaSpacerView';
3
+ import SafeAreaSpacerView from './SafeArea';
4
4
  import SafeAreaInsetsManager from './SafeArea/SafeAreaInsetsManager';
5
5
  import Keyboard, { KeyboardTrackingViewProps, KeyboardAccessoryViewProps } from './Keyboard';
6
6
  export { DynamicFonts, FontExtension, HighlighterOverlayView, SafeAreaSpacerView, SafeAreaInsetsManager, Keyboard, KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
@@ -1,6 +1,6 @@
1
1
  import DynamicFonts, { FontExtension } from "./DynamicFonts";
2
2
  import HighlighterOverlayView from "./HighlighterOverlayView";
3
- import SafeAreaSpacerView from "./SafeArea/SafeAreaSpacerView";
3
+ import SafeAreaSpacerView from "./SafeArea";
4
4
  import SafeAreaInsetsManager from "./SafeArea/SafeAreaInsetsManager";
5
5
  import Keyboard, { KeyboardTrackingViewProps, KeyboardAccessoryViewProps } from "./Keyboard";
6
6
  export { DynamicFonts, FontExtension, HighlighterOverlayView, SafeAreaSpacerView, SafeAreaInsetsManager, Keyboard, KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
@@ -11,11 +11,12 @@
11
11
  #import "UIResponder+FirstResponderTemp.h"
12
12
 
13
13
  #import <WebKit/WebKit.h>
14
- #import <React/RCTScrollView.h>
14
+
15
15
  #import <React/RCTBridge.h>
16
16
  #import <React/RCTUIManager.h>
17
17
  #import <React/UIView+React.h>
18
18
  #import <React/RCTUIManagerUtils.h>
19
+ #import <React/RCTSurfaceHostingView.h>
19
20
 
20
21
  #import <objc/runtime.h>
21
22
 
@@ -70,7 +71,7 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
70
71
 
71
72
  if (self)
72
73
  {
73
- [self addObserver:self forKeyPath:@"bounds" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL];
74
+ [self addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew context:NULL];
74
75
  _inputViewsMap = [NSMapTable weakToWeakObjectsMapTable];
75
76
  _deferedInitializeAccessoryViewsCount = 0;
76
77
 
@@ -93,20 +94,21 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
93
94
  return self;
94
95
  }
95
96
 
96
- -(RCTRootView*)getRootView
97
+ -(UIView*)getRootView
97
98
  {
98
99
  UIView *view = self;
99
100
  while (view.superview != nil)
100
101
  {
101
102
  view = view.superview;
102
- if ([view isKindOfClass:[RCTRootView class]])
103
+ if ([view isKindOfClass:[RCTSurfaceHostingView class]]) {
103
104
  break;
105
+ }
104
106
  }
105
107
 
106
- if ([view isKindOfClass:[RCTRootView class]])
107
- {
108
- return (RCTRootView*)view;
108
+ if ([view isKindOfClass:[RCTSurfaceHostingView class]]) {
109
+ return view;
109
110
  }
111
+
110
112
  return nil;
111
113
  }
112
114
 
@@ -169,10 +171,20 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
169
171
  [self updateBottomViewFrame];
170
172
  }
171
173
 
174
+ - (UIScrollView*)extractUIScrollView:(UIView*)view
175
+ {
176
+ for (UIView* subview in view.subviews) {
177
+ if ([subview isKindOfClass:[UIScrollView class]]) {
178
+ return (UIScrollView*)subview;
179
+ }
180
+ }
181
+
182
+ return nil;
183
+ }
184
+
172
185
  - (void)initializeAccessoryViewsAndHandleInsets
173
186
  {
174
187
  NSArray<UIView*>* allSubviews = [self getBreadthFirstSubviewsForView:[self getRootView]];
175
- NSMutableArray<RCTScrollView*>* rctScrollViewsArray = [NSMutableArray array];
176
188
 
177
189
  for (UIView* subview in allSubviews)
178
190
  {
@@ -180,26 +192,29 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
180
192
  {
181
193
  if(_scrollViewToManage == nil)
182
194
  {
183
- if(_requiresSameParentToManageScrollView && [subview isKindOfClass:[RCTScrollView class]] && subview.superview == self.superview)
184
- {
185
- _scrollViewToManage = ((RCTScrollView*)subview).scrollView;
186
- }
187
- else if(!_requiresSameParentToManageScrollView && [subview isKindOfClass:[UIScrollView class]])
188
- {
189
- _scrollViewToManage = (UIScrollView*)subview;
195
+ if ([NSStringFromClass([subview class]) isEqualToString:@"RCTScrollViewComponentView"]) {
196
+ UIScrollView *scrollView = [self extractUIScrollView:subview];
197
+
198
+ if ([scrollView isKindOfClass:[UIScrollView class]])
199
+ {
200
+ if(_requiresSameParentToManageScrollView && subview.superview == self.superview)
201
+ {
202
+ _scrollViewToManage = scrollView;
203
+ }
204
+ else if(!_requiresSameParentToManageScrollView)
205
+ {
206
+ _scrollViewToManage = scrollView;
207
+ }
208
+
209
+ if(_scrollViewToManage != nil)
210
+ {
211
+ _scrollIsInverted = CGAffineTransformEqualToTransform(subview.superview.transform, CGAffineTransformMakeScale(1, -1));
212
+ }
213
+ }
190
214
  }
191
-
192
- if(_scrollViewToManage != nil)
193
- {
194
- _scrollIsInverted = CGAffineTransformEqualToTransform(_scrollViewToManage.superview.transform, CGAffineTransformMakeScale(1, -1));
195
- }
196
- }
197
-
198
- if([subview isKindOfClass:[RCTScrollView class]])
199
- {
200
- [rctScrollViewsArray addObject:(RCTScrollView*)subview];
201
215
  }
202
216
  }
217
+
203
218
 
204
219
  if ([subview isKindOfClass:NSClassFromString(@"RCTTextField")])
205
220
  {
@@ -247,13 +262,11 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
247
262
  }
248
263
  }
249
264
 
250
- for (RCTScrollView *scrollView in rctScrollViewsArray)
265
+ if(_scrollViewToManage != nil)
251
266
  {
252
- if(scrollView.scrollView == _scrollViewToManage)
267
+ if(_scrollViewToManage.delegate == nil)
253
268
  {
254
- [scrollView removeScrollListener:self];
255
- [scrollView addScrollListener:self];
256
- break;
269
+ _scrollViewToManage.delegate = self;
257
270
  }
258
271
  }
259
272
 
@@ -338,12 +351,12 @@ typedef NS_ENUM(NSUInteger, KeyboardTrackingScrollBehavior) {
338
351
 
339
352
  -(void)dealloc
340
353
  {
341
- [self removeObserver:self forKeyPath:@"bounds"];
354
+ [self removeObserver:self forKeyPath:@"frame"];
342
355
  }
343
356
 
344
357
  - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context
345
358
  {
346
- _ObservingInputAccessoryViewTemp.height = self.bounds.size.height;
359
+ _ObservingInputAccessoryViewTemp.height = self.frame.size.height;
347
360
  }
348
361
 
349
362
  - (void)ObservingInputAccessoryViewTempKeyboardWillDisappear:(ObservingInputAccessoryViewTemp *)ObservingInputAccessoryViewTemp
package/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uilib-native",
3
- "version": "4.5.2",
3
+ "version": "5.0.0-snapshot.7253",
4
4
  "homepage": "https://github.com/wix/react-native-ui-lib",
5
5
  "description": "uilib native components (separated from js components)",
6
6
  "main": "components/index",
@@ -10,11 +10,9 @@ module.exports = {
10
10
  sourceDir: './android/',
11
11
  packageImportPath: `import com.wix.reactnativeuilib.dynamicfont.DynamicFontPackage;
12
12
  import com.wix.reactnativeuilib.highlighterview.HighlighterViewPackage;
13
- import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;
14
- import com.wix.reactnativeuilib.textinput.TextInputDelKeyHandlerPackage;`,
13
+ import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;`,
15
14
  packageInstance: `new DynamicFontPackage(),
16
15
  new HighlighterViewPackage(),
17
- new TextInputDelKeyHandlerPackage(),
18
16
  new KeyboardInputPackage(getApplication())`
19
17
  }
20
18
  }
package/metro.config.js CHANGED
@@ -5,9 +5,9 @@ const {assetExts, sourceExts} = defaultConfig.resolver;
5
5
 
6
6
  /**
7
7
  * Metro configuration
8
- * https://facebook.github.io/metro/docs/configuration
8
+ * https://reactnative.dev/docs/metro
9
9
  *
10
- * @type {import('metro-config').MetroConfig}
10
+ * @type {import('@react-native/metro-config').MetroConfig}
11
11
  */
12
12
 
13
13
  const config = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "7.44.0-snapshot.7249",
3
+ "version": "7.45.0-snapshot.7253",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -56,15 +56,15 @@
56
56
  "react-native-redash": "^12.0.3",
57
57
  "semver": "^5.5.0",
58
58
  "tinycolor2": "^1.4.2",
59
- "uilib-native": "4.5.1",
59
+ "uilib-native": "5.0.0-snapshot.7240",
60
60
  "url-parse": "^1.2.0",
61
61
  "wix-react-native-text-size": "1.0.9"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@babel/cli": "^7.16.8",
65
- "@babel/core": "^7.24.4",
65
+ "@babel/core": "^7.25.2",
66
66
  "@babel/plugin-transform-modules-commonjs": "^7.17.9",
67
- "@babel/preset-env": "^7.20.0",
67
+ "@babel/preset-env": "^7.25.3",
68
68
  "@babel/preset-react": "^7.10.1",
69
69
  "@babel/runtime": "^7.26.10",
70
70
  "@formatjs/intl-datetimeformat": "^6.0.3",
@@ -73,28 +73,29 @@
73
73
  "@formatjs/intl-numberformat": "^8.0.4",
74
74
  "@formatjs/intl-pluralrules": "^5.0.3",
75
75
  "@react-native-community/blur": "4.4.1",
76
- "@react-native-community/datetimepicker": "^3.4.6",
77
- "@react-native-community/netinfo": "^5.6.2",
78
- "@react-native/babel-preset": "0.73.21",
79
- "@react-native/eslint-config": "0.73.2",
80
- "@react-native/metro-config": "0.73.5",
81
- "@react-native/typescript-config": "0.73.1",
76
+ "@react-native-community/cli": "15.0.1",
77
+ "@react-native-community/cli-platform-android": "15.0.1",
78
+ "@react-native-community/cli-platform-ios": "15.0.1",
79
+ "@react-native-community/datetimepicker": "8.2.0",
80
+ "@react-native-community/netinfo": "11.3.3",
81
+ "@react-native/babel-preset": "0.77.2",
82
+ "@react-native/eslint-config": "0.77.2",
83
+ "@react-native/metro-config": "0.77.2",
84
+ "@react-native/typescript-config": "0.77.2",
82
85
  "@shopify/flash-list": "1.7.6",
83
86
  "@testing-library/react-hooks": "^8.0.1",
84
87
  "@testing-library/react-native": "^11.5.1",
85
88
  "@types/hoist-non-react-statics": "^3.3.1",
86
- "@types/jest": "^29.2.1",
89
+ "@types/jest": "^29.5.13",
87
90
  "@types/lodash": "^4.0.0",
88
91
  "@types/prop-types": "^15.5.3",
89
92
  "@types/react": "18.3.7",
90
- "@types/react-native": "0.73.0",
91
93
  "@types/react-test-renderer": "^18.3.0",
92
94
  "@types/tinycolor2": "^1.4.2",
93
95
  "@types/url-parse": "^1.4.3",
94
96
  "@typescript-eslint/eslint-plugin": "^5.3.1",
95
97
  "@typescript-eslint/parser": "^5.3.1",
96
98
  "@welldone-software/why-did-you-render": "^3.2.1",
97
- "babel-jest": "^29.6.3",
98
99
  "babel-plugin-lodash": "^3.3.4",
99
100
  "babel-plugin-module-resolver": "^5.0.0",
100
101
  "eslint": "8.19.0",
@@ -104,7 +105,6 @@
104
105
  "eslint-plugin-react-native": "^4.0.0",
105
106
  "jest": "^29.6.3",
106
107
  "light-date": "^1.2.0",
107
- "metro-react-native-babel-preset": "0.73.10",
108
108
  "moment": "^2.24.0",
109
109
  "object-hash": "^3.0.0",
110
110
  "postcss": "^8.4.21",
@@ -114,27 +114,28 @@
114
114
  "react": "18.2.0",
115
115
  "react-autobind": "^1.0.6",
116
116
  "react-dom": "^18.2.0",
117
- "react-native": "0.73.9",
117
+ "react-native": "0.77.2",
118
118
  "react-native-fs": "^2.20.0",
119
- "react-native-gesture-handler": "2.14.1",
119
+ "react-native-gesture-handler": "2.22.1",
120
120
  "react-native-haptic-feedback": "^1.11.0",
121
121
  "react-native-linear-gradient": "2.6.2",
122
- "react-native-mmkv": "2.11.0",
123
- "react-native-navigation": "7.40.1",
122
+ "react-native-mmkv": "3.2.0",
123
+ "react-native-navigation": "8.1.0",
124
124
  "react-native-reanimated": "3.16.7",
125
125
  "react-native-shimmer-placeholder": "^2.0.6",
126
- "react-native-svg": "15.2.0",
126
+ "react-native-svg": "15.11.2",
127
127
  "react-native-svg-transformer": "1.5.0",
128
- "react-test-renderer": "18.2.0",
128
+ "react-test-renderer": "18.3.1",
129
129
  "reassure": "^0.4.1",
130
+ "setimmediate": "^1.0.5",
130
131
  "shell-utils": "^1.0.10",
131
132
  "typescript": "5.0.4"
132
133
  },
133
134
  "peerDependencies": {
134
135
  "react": ">=17.0.1",
135
- "react-native": ">=0.64.1",
136
- "react-native-gesture-handler": ">=2.5.0",
137
- "react-native-reanimated": ">=2.0.0",
136
+ "react-native": ">=0.76.0",
137
+ "react-native-gesture-handler": ">=2.22.0",
138
+ "react-native-reanimated": ">=3.16.7",
138
139
  "react-native-ui-lib": "*"
139
140
  },
140
141
  "jest": {
@@ -162,7 +163,6 @@
162
163
  "engines": {
163
164
  "node": ">=18"
164
165
  },
165
- "packageManager": "yarn@3.4.1",
166
166
  "files": [
167
167
  "*.js",
168
168
  "*.d.ts",
package/panView.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import {PanView} from './src';
2
+ export default PanView;
package/panView.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./src/components/panView').default;
@@ -10,11 +10,9 @@ module.exports = {
10
10
  sourceDir: '../uilib-native/android/',
11
11
  packageImportPath: `import com.wix.reactnativeuilib.dynamicfont.DynamicFontPackage;
12
12
  import com.wix.reactnativeuilib.highlighterview.HighlighterViewPackage;
13
- import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;
14
- import com.wix.reactnativeuilib.textinput.TextInputDelKeyHandlerPackage;`,
13
+ import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;`,
15
14
  packageInstance: `new DynamicFontPackage(),
16
15
  new HighlighterViewPackage(),
17
- new TextInputDelKeyHandlerPackage(),
18
16
  new KeyboardInputPackage(getApplication())`
19
17
  }
20
18
  }
@@ -24,11 +24,8 @@ function setStatusBarHeight() {
24
24
  const {
25
25
  StatusBarManager
26
26
  } = NativeModules;
27
- statusBarHeight = (StatusBar.currentHeight ?? StatusBarManager?.HEIGHT) || 0;
28
- if (isIOS && StatusBarManager) {
29
- // override guesstimate height with the actual height from StatusBarManager
30
- StatusBarManager.getHeight(data => statusBarHeight = data.height);
31
- }
27
+ // override guesstimate height with the actual height from StatusBarManager
28
+ statusBarHeight = (StatusBar.currentHeight ?? StatusBarManager?.getConstants?.()?.HEIGHT) || 0;
32
29
  }
33
30
  function getAspectRatio() {
34
31
  return screenWidth < screenHeight ? screenHeight / screenWidth : screenWidth / screenHeight;