react-native-ui-lib 7.46.3-snapshot.7360 → 7.46.3-snapshot.7367

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 (202) hide show
  1. package/babel.config.js +0 -12
  2. package/index.js +0 -1
  3. package/lib/android/build.gradle +5 -5
  4. package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +2 -0
  5. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +23 -31
  6. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReactHacks.java +30 -0
  7. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java +34 -0
  8. package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +1 -1
  9. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java +33 -0
  10. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/KeyListenerProxy.java +53 -0
  11. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.java +54 -0
  12. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.java +28 -0
  13. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/ViewUtils.java +36 -0
  14. package/lib/components/{HighlighterOverlayView/index.d.ts → HighlighterOverlayView.d.ts} +1 -1
  15. package/lib/components/HighlighterOverlayView.js +40 -0
  16. package/lib/components/{HighlighterOverlayView/index.web.d.ts → HighlighterOverlayView.web.d.ts} +1 -1
  17. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.android.d.ts +2 -5
  18. package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +28 -0
  19. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.ios.d.ts +1 -1
  20. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.ios.js +3 -3
  21. package/lib/components/Keyboard/{KeyboardAccessoryView/CustomKeyboardView → KeyboardInput}/CustomKeyboardViewBase.d.ts +0 -3
  22. package/lib/components/Keyboard/{KeyboardAccessoryView/CustomKeyboardView → KeyboardInput}/CustomKeyboardViewBase.js +1 -1
  23. package/lib/components/Keyboard/{KeyboardAccessoryView/index.d.ts → KeyboardInput/KeyboardAccessoryView.d.ts} +1 -11
  24. package/lib/components/Keyboard/{KeyboardAccessoryView/index.js → KeyboardInput/KeyboardAccessoryView.js} +5 -31
  25. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/index.d.ts → KeyboardInput/KeyboardRegistry.d.ts} +1 -1
  26. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/index.js → KeyboardInput/KeyboardRegistry.js} +1 -1
  27. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry → KeyboardInput}/__tests__/KeyboardRegistry.spec.js +1 -1
  28. package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/keyboardAccessoryView.api.json +5 -5
  29. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry → KeyboardInput}/keyboardRegistry.api.json +9 -9
  30. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +11 -0
  31. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.js +17 -0
  32. package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager → KeyboardInput/utils}/__tests__/EventEmitterManager.spec.js +1 -1
  33. package/lib/components/Keyboard/{KeyboardAwareInsetsView/index.d.ts → KeyboardTracking/KeyboardAwareInsetsView.d.ts} +1 -1
  34. package/lib/components/Keyboard/{KeyboardAwareInsetsView/index.js → KeyboardTracking/KeyboardAwareInsetsView.js} +1 -1
  35. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.ios.d.ts +4 -1
  36. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.ios.js +8 -5
  37. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.d.ts +2 -2
  38. package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/keyboardTrackingView.api.json +20 -11
  39. package/lib/components/Keyboard/index.d.ts +6 -6
  40. package/lib/components/Keyboard/index.js +6 -6
  41. package/lib/components/SafeArea/SafeAreaInsetsManager.d.ts +7 -21
  42. package/lib/components/SafeArea/SafeAreaInsetsManager.js +31 -95
  43. package/lib/components/SafeArea/SafeAreaSpacerView.d.ts +2 -2
  44. package/lib/components/SafeArea/SafeAreaSpacerView.js +9 -63
  45. package/lib/components/index.d.ts +1 -1
  46. package/lib/components/index.js +1 -1
  47. package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.m +8 -52
  48. package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h +7 -1
  49. package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.m +1 -1
  50. package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +41 -109
  51. package/lib/package.json +3 -3
  52. package/lib/react-native.config.js +3 -1
  53. package/metro.config.js +2 -2
  54. package/package.json +29 -29
  55. package/panningViews.d.ts +2 -0
  56. package/panningViews.js +1 -0
  57. package/react-native.config.js +3 -1
  58. package/sharedTransition.d.ts +2 -0
  59. package/sharedTransition.js +1 -0
  60. package/src/commons/Constants.js +5 -2
  61. package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +1 -5
  62. package/src/components/actionSheet/index.d.ts +12 -2
  63. package/src/components/actionSheet/index.js +42 -3
  64. package/src/components/animatedImage/index.js +6 -16
  65. package/src/components/badge/index.d.ts +47 -107
  66. package/src/components/button/button.api.json +1 -1
  67. package/src/components/button/index.d.ts +23 -53
  68. package/src/components/button/types.d.ts +1 -0
  69. package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
  70. package/src/components/colorPicker/ColorPickerDialog.js +1 -1
  71. package/src/components/dateTimePicker/index.d.ts +5 -186
  72. package/src/components/dateTimePicker/index.js +4 -3
  73. package/src/components/dialog/DialogDismissibleView.d.ts +34 -0
  74. package/src/components/dialog/DialogDismissibleView.js +184 -0
  75. package/src/components/dialog/OverlayFadingBackground.d.ts +14 -0
  76. package/src/components/dialog/OverlayFadingBackground.js +45 -0
  77. package/src/components/dialog/dialog.api.json +37 -31
  78. package/src/components/dialog/index.d.ts +105 -13
  79. package/src/components/dialog/index.js +212 -204
  80. package/src/components/drawer/Swipeable.js +2 -1
  81. package/src/components/drawer/index.js +25 -31
  82. package/src/components/fadedScrollView/index.js +2 -7
  83. package/src/components/featureHighlight/index.d.ts +1 -1
  84. package/src/components/index.js +19 -0
  85. package/src/components/marquee/types.js +1 -4
  86. package/src/components/modal/index.d.ts +0 -5
  87. package/src/components/modal/index.js +10 -14
  88. package/src/components/modal/modal.api.json +0 -5
  89. package/src/components/panningViews/asPanViewConsumer.d.ts +3 -0
  90. package/src/components/panningViews/asPanViewConsumer.js +16 -0
  91. package/src/components/panningViews/panDismissibleView.d.ts +51 -0
  92. package/src/components/panningViews/panDismissibleView.js +350 -0
  93. package/src/components/panningViews/panGestureView.d.ts +23 -0
  94. package/src/components/panningViews/panGestureView.js +156 -0
  95. package/src/components/panningViews/panListenerView.d.ts +66 -0
  96. package/src/components/panningViews/panListenerView.js +155 -0
  97. package/src/components/panningViews/panResponderView.d.ts +19 -0
  98. package/src/components/panningViews/panResponderView.js +79 -0
  99. package/src/components/panningViews/panningContext.d.ts +3 -0
  100. package/src/components/panningViews/panningContext.js +4 -0
  101. package/src/components/panningViews/panningProvider.d.ts +73 -0
  102. package/src/components/panningViews/panningProvider.js +101 -0
  103. package/src/components/picker/Picker.driver.new.d.ts +2 -2
  104. package/src/components/picker/Picker.driver.new.js +3 -3
  105. package/src/components/picker/PickerItem.js +20 -6
  106. package/src/components/picker/PickerPresenter.d.ts +1 -0
  107. package/src/components/picker/PickerPresenter.js +23 -1
  108. package/src/components/picker/api/picker.api.json +1 -0
  109. package/src/components/picker/api/pickerItem.api.json +5 -0
  110. package/src/components/picker/helpers/useFieldType.d.ts +23 -53
  111. package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
  112. package/src/components/picker/helpers/usePickerLabel.js +3 -2
  113. package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
  114. package/src/components/picker/helpers/usePickerMigrationWarnings.js +12 -0
  115. package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
  116. package/src/components/picker/helpers/usePickerSearch.js +8 -4
  117. package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
  118. package/src/components/picker/helpers/usePickerSelection.js +10 -2
  119. package/src/components/picker/index.js +22 -4
  120. package/src/components/picker/types.d.ts +24 -1
  121. package/src/components/segmentedControl/index.js +3 -3
  122. package/src/components/sharedTransition/ShareTransitionContext.js +3 -0
  123. package/src/components/sharedTransition/SharedArea.js +153 -0
  124. package/src/components/sharedTransition/SourceElement.js +44 -0
  125. package/src/components/sharedTransition/TargetElement.js +38 -0
  126. package/src/components/sharedTransition/index.js +9 -0
  127. package/src/components/slider/GradientSlider.d.ts +1 -1
  128. package/src/components/sortableGridList/SortableItem.js +4 -13
  129. package/src/components/sortableList/SortableListItem.js +4 -13
  130. package/src/components/stackAggregator/index.js +11 -16
  131. package/src/components/text/Text.driver.new.d.ts +2 -2
  132. package/src/components/text/Text.driver.new.js +2 -2
  133. package/src/components/textField/Input.js +1 -0
  134. package/src/components/textField/TextField.driver.new.d.ts +2 -2
  135. package/src/components/textField/TextField.driver.new.js +2 -2
  136. package/src/components/textField/presets/outline.d.ts +46 -106
  137. package/src/components/textField/presets/underline.d.ts +46 -106
  138. package/src/components/textField/types.js +0 -1
  139. package/src/components/textField/usePreset.d.ts +44 -72
  140. package/src/components/timeline/types.js +0 -3
  141. package/src/incubator/dialog/dialog.api.json +54 -0
  142. package/src/{components → incubator}/dialog/dialogHeader.api.json +2 -2
  143. package/src/incubator/dialog/index.d.ts +15 -0
  144. package/src/incubator/dialog/index.js +218 -0
  145. package/src/{components → incubator}/dialog/types.d.ts +19 -0
  146. package/src/{components → incubator}/dialog/types.js +3 -1
  147. package/src/{components → incubator}/dialog/useDialogContent.d.ts +1 -1
  148. package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
  149. package/src/incubator/expandableOverlay/index.d.ts +3 -42
  150. package/src/incubator/expandableOverlay/index.js +4 -1
  151. package/src/{hooks/useHiddenLocation/index.d.ts → incubator/hooks/useHiddenLocation.d.ts} +1 -1
  152. package/src/{hooks/useHiddenLocation/index.web.d.ts → incubator/hooks/useHiddenLocation.web.d.ts} +1 -1
  153. package/src/incubator/index.d.ts +2 -0
  154. package/src/incubator/index.js +2 -0
  155. package/src/{components → incubator}/panView/index.d.ts +3 -3
  156. package/src/{components → incubator}/panView/index.js +4 -4
  157. package/src/{components → incubator}/panView/usePanGesture.d.ts +1 -1
  158. package/src/incubator/toast/index.js +1 -1
  159. package/src/index.d.ts +10 -3
  160. package/src/index.js +162 -42
  161. package/src/testkit/index.d.ts +1 -1
  162. package/src/testkit/index.js +1 -1
  163. package/src/testkit/new/Component.driver.d.ts +1 -4
  164. package/src/testkit/new/Component.driver.js +3 -3
  165. package/lib/components/HighlighterOverlayView/index.js +0 -49
  166. package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +0 -51
  167. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +0 -26
  168. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +0 -91
  169. package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +0 -274
  170. package/lib/components/SafeArea/index.d.ts +0 -10
  171. package/lib/components/SafeArea/index.js +0 -11
  172. package/panView.d.ts +0 -2
  173. package/panView.js +0 -1
  174. /package/lib/components/{HighlighterOverlayView/index.web.js → HighlighterOverlayView.web.js} +0 -0
  175. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.d.ts +0 -0
  176. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.js +0 -0
  177. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.d.ts +0 -0
  178. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.js +0 -0
  179. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
  180. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
  181. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
  182. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
  183. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.d.ts +0 -0
  184. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.js +0 -0
  185. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts → KeyboardInput/utils/EventEmitterManager.d.ts} +0 -0
  186. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js → KeyboardInput/utils/EventEmitterManager.js} +0 -0
  187. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
  188. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
  189. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.js +0 -0
  190. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.d.ts +0 -0
  191. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.js +0 -0
  192. /package/lib/components/Keyboard/{KeyboardAwareInsetsView → KeyboardTracking}/keyboardAwareInsetsView.api.json +0 -0
  193. /package/src/{components → incubator}/dialog/Dialog.driver.new.d.ts +0 -0
  194. /package/src/{components → incubator}/dialog/Dialog.driver.new.js +0 -0
  195. /package/src/{components → incubator}/dialog/DialogHeader.d.ts +0 -0
  196. /package/src/{components → incubator}/dialog/DialogHeader.js +0 -0
  197. /package/src/{components → incubator}/dialog/useDialogContent.js +0 -0
  198. /package/src/{hooks/useHiddenLocation/index.js → incubator/hooks/useHiddenLocation.js} +0 -0
  199. /package/src/{hooks/useHiddenLocation/index.web.js → incubator/hooks/useHiddenLocation.web.js} +0 -0
  200. /package/src/{components → incubator}/panView/panningUtil.d.ts +0 -0
  201. /package/src/{components → incubator}/panView/panningUtil.js +0 -0
  202. /package/src/{components → incubator}/panView/usePanGesture.js +0 -0
@@ -1,8 +1,8 @@
1
1
  import React, { Component } from 'react';
2
2
  import { StyleSheet, Platform, NativeModules, NativeEventEmitter, DeviceEventEmitter, processColor, BackHandler } from 'react-native';
3
- import KeyboardTrackingView from "../KeyboardTrackingView";
3
+ import KeyboardTrackingView from "../KeyboardTracking/KeyboardTrackingView";
4
4
  import CustomKeyboardView from "./CustomKeyboardView";
5
- import KeyboardUtils, { KeyboardHeightListener } from "./KeyboardUtils";
5
+ import KeyboardUtils from "./utils/KeyboardUtils";
6
6
  const IsIOS = Platform.OS === 'ios';
7
7
  const IsAndroid = Platform.OS === 'android';
8
8
  /**
@@ -20,11 +20,9 @@ class KeyboardAccessoryView extends Component {
20
20
  allowHitsOutsideBounds: false,
21
21
  scrollBehavior: KeyboardTrackingView.scrollBehaviors.FIXED_OFFSET
22
22
  };
23
- static currentId = 0;
24
23
 
25
24
  // TODO: fix
26
25
 
27
- id = ++KeyboardAccessoryView.currentId;
28
26
  constructor(props) {
29
27
  super(props);
30
28
  this.onContainerComponentHeightChanged = this.onContainerComponentHeightChanged.bind(this);
@@ -35,16 +33,12 @@ class KeyboardAccessoryView extends Component {
35
33
  this.registerForKeyboardResignedEvent();
36
34
  this.registerAndroidBackHandler();
37
35
  }
38
- state = {
39
- keyboardHeight: 0,
40
- shouldFocus: true
41
- };
42
36
  componentWillUnmount() {
43
37
  if (this.customInputControllerEventsSubscriber) {
44
38
  this.customInputControllerEventsSubscriber.remove();
45
39
  }
46
40
  if (IsAndroid) {
47
- this.subscription.remove();
41
+ BackHandler.removeEventListener('hardwareBackPress', this.onAndroidBackPressed);
48
42
  }
49
43
  }
50
44
  onContainerComponentHeightChanged(event) {
@@ -93,7 +87,7 @@ class KeyboardAccessoryView extends Component {
93
87
  }
94
88
  registerAndroidBackHandler() {
95
89
  if (IsAndroid) {
96
- this.subscription = BackHandler.addEventListener('hardwareBackPress', this.onAndroidBackPressed);
90
+ BackHandler.addEventListener('hardwareBackPress', this.onAndroidBackPressed);
97
91
  }
98
92
  }
99
93
  processInitialProps() {
@@ -112,26 +106,7 @@ class KeyboardAccessoryView extends Component {
112
106
  this.trackingViewRef.scrollToStart();
113
107
  }
114
108
  }
115
- onKeyboardHeightChange = keyboardHeight => {
116
- this.setState({
117
- keyboardHeight
118
- });
119
- };
120
- onDismiss = () => {
121
- this.setState({
122
- shouldFocus: false
123
- });
124
- };
125
- onKeyboardDismiss = () => {
126
- this.setState({
127
- shouldFocus: true
128
- });
129
- };
130
109
  render() {
131
- const {
132
- keyboardHeight,
133
- shouldFocus
134
- } = this.state;
135
110
  const {
136
111
  renderContent,
137
112
  kbInputRef,
@@ -142,9 +117,8 @@ class KeyboardAccessoryView extends Component {
142
117
  ...others
143
118
  } = this.props;
144
119
  return <KeyboardTrackingView {...others} scrollBehavior={scrollBehavior} ref={r => this.trackingViewRef = r} style={styles.trackingToolbarContainer} onLayout={this.onContainerComponentHeightChanged}>
145
- <KeyboardHeightListener id={`${this.id}`} onDismiss={this.onDismiss} onKeyboardHeightChange={this.onKeyboardHeightChange} />
146
120
  <>{renderContent?.()}</>
147
- <CustomKeyboardView keyboardHeight={keyboardHeight} shouldFocus={shouldFocus} onKeyboardDismiss={this.onKeyboardDismiss} inputRef={kbInputRef} component={kbComponent} initialProps={this.processInitialProps()} onItemSelected={onItemSelected} onRequestShowKeyboard={onRequestShowKeyboard} useSafeArea={others.useSafeArea} />
121
+ <CustomKeyboardView inputRef={kbInputRef} component={kbComponent} initialProps={this.processInitialProps()} onItemSelected={onItemSelected} onRequestShowKeyboard={onRequestShowKeyboard} useSafeArea={others.useSafeArea} />
148
122
  </KeyboardTrackingView>;
149
123
  }
150
124
  }
@@ -1,4 +1,4 @@
1
- import EventEmitterManager from './EventEmitterManager';
1
+ import EventEmitterManager from './utils/EventEmitterManager';
2
2
  /**
3
3
  * @description: used for registering keyboards and performing certain actions on the keyboards.
4
4
  * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/demoKeyboards.js
@@ -1,7 +1,7 @@
1
1
  import _intersection from "lodash/intersection";
2
2
  import _isFunction from "lodash/isFunction";
3
3
  import { AppRegistry } from 'react-native';
4
- import EventEmitterManager from "./EventEmitterManager";
4
+ import EventEmitterManager from "./utils/EventEmitterManager";
5
5
 
6
6
  /*
7
7
  * Tech debt: how to deal with multiple registries in the app?
@@ -1,6 +1,6 @@
1
1
  import {AppRegistry, View} from 'react-native';
2
2
  import React from 'react';
3
- import KeyboardRegistry from '../index';
3
+ import KeyboardRegistry from '../KeyboardRegistry';
4
4
 
5
5
  describe('KeyboardRegistry - components', () => {
6
6
  const mockComponent = 'test_component';
@@ -15,9 +15,9 @@
15
15
  {
16
16
  "name": "kbInputRef",
17
17
  "type": "any",
18
- "description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.)",
19
- "note": "iOS only",
20
- "required": true
18
+ "description": "The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).",
19
+ "required": true,
20
+ "note": "iOS only"
21
21
  },
22
22
  {
23
23
  "name": "kbComponent",
@@ -33,12 +33,12 @@
33
33
  {
34
34
  "name": "onItemSelected",
35
35
  "type": "() => void",
36
- "description": "Callback that will be called when an item on the keyboard has been pressed"
36
+ "description": "Callback that will be called when an item on the keyboard has been pressed."
37
37
  },
38
38
  {
39
39
  "name": "onRequestShowKeyboard",
40
40
  "type": "() => void",
41
- "description": "Callback that will be called if KeyboardRegistry.requestShowKeyboard is called"
41
+ "description": "Callback that will be called if KeyboardRegistry.requestShowKeyboard is called."
42
42
  },
43
43
  {
44
44
  "name": "onKeyboardResigned",
@@ -1,49 +1,49 @@
1
1
  {
2
2
  "name": "KeyboardRegistry",
3
3
  "category": "infra",
4
- "description": "used for registering keyboards and performing certain actions on the keyboards",
4
+ "description": "used for registering keyboards and performing certain actions on the keyboards.",
5
5
  "example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/demoKeyboards.js",
6
6
  "props": [
7
7
  {
8
8
  "name": "registerKeyboard",
9
9
  "type": "static function",
10
- "description": "Register a new keyboard.\ncomponentID (string) - the ID of the keyboard.\ngenerator (function) - a function for the creation of the keyboard.\nparams (object) - to be returned when using other methods (i.e. getKeyboards and getAllKeyboards)"
10
+ "description": "Register a new keyboard.\ncomponentID (string) - the ID of the keyboard.\ngenerator (function) - a function for the creation of the keyboard.\nparams (object) - to be returned when using other methods (i.e. getKeyboards and getAllKeyboards)."
11
11
  },
12
12
  {
13
13
  "name": "getKeyboard",
14
14
  "type": "static function",
15
- "description": "Get a specific keyboard\ncomponentID (string) - the ID of the keyboard"
15
+ "description": "Get a specific keyboard\ncomponentID (string) - the ID of the keyboard."
16
16
  },
17
17
  {
18
18
  "name": "getKeyboards",
19
19
  "type": "static function",
20
- "description": "Get keyboards by IDs\ncomponentIDs (string[]) - the ID of the keyboard"
20
+ "description": "Get keyboards by IDs\ncomponentIDs (string[]) - the ID of the keyboard."
21
21
  },
22
22
  {"name": "getAllKeyboards", "type": "static function", "description": "Get all keyboards"},
23
23
  {
24
24
  "name": "addListener",
25
25
  "type": "static function",
26
- "description": "Add a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n(i.e. if componentID='kb1' globalID='kb1.onItemSelected')\ncallback (function) - the callback to be called when the said event happens"
26
+ "description": "Add a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')\ncallback (function) - the callback to be called when the said event happens"
27
27
  },
28
28
  {
29
29
  "name": "notifyListeners",
30
30
  "type": "static function",
31
- "description": "Notify that an event has occurred.\nglobalID (string) - ID that includes the componentID and the event name\n(i.e. if componentID='kb1' globalID='kb1.onItemSelected')\nargs (object) - data to be sent to the listener"
31
+ "description": "Notify that an event has occurred.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')\nargs (object) - data to be sent to the listener."
32
32
  },
33
33
  {
34
34
  "name": "removeListeners",
35
35
  "type": "static function",
36
- "description": "Remove a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n(i.e. if componentID='kb1' globalID='kb1.onItemSelected')"
36
+ "description": "Remove a listener for a callback.\nglobalID (string) - ID that includes the componentID and the event name\n (i.e. if componentID='kb1' globalID='kb1.onItemSelected')"
37
37
  },
38
38
  {
39
39
  "name": "onItemSelected",
40
40
  "type": "static function",
41
- "description": "Default event to be used for when an item on the keyboard has been pressed.\ncomponentID (string) - the ID of the keyboard.\nargs (object) - data to be sent to the listener"
41
+ "description": "Default event to be used for when an item on the keyboard has been pressed.\ncomponentID (string) - the ID of the keyboard.\nargs (object) - data to be sent to the listener."
42
42
  },
43
43
  {
44
44
  "name": "requestShowKeyboard",
45
45
  "type": "static function",
46
- "description": "Request to show the keyboard\ncomponentID (string) - the ID of the keyboard"
46
+ "description": "Request to show the keyboard\ncomponentID (string) - the ID of the keyboard."
47
47
  }
48
48
  ],
49
49
  "snippet": ["KeyboardRegistry.registerKeyboard('keyboardName$1', () => KeyboardComponent$2)"]
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @description: util for managing the keyboard.
3
+ * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js
4
+ */
5
+ export default class KeyboardUtils {
6
+ static displayName: string;
7
+ /**
8
+ * Used to dismiss (close) the keyboard.
9
+ */
10
+ static dismiss: () => void;
11
+ }
@@ -0,0 +1,17 @@
1
+ import { Keyboard } from 'react-native';
2
+ import TextInputKeyboardManager from "../TextInputKeyboardManager";
3
+
4
+ /**
5
+ * @description: util for managing the keyboard.
6
+ * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js
7
+ */
8
+ export default class KeyboardUtils {
9
+ static displayName = 'KeyboardUtils';
10
+ /**
11
+ * Used to dismiss (close) the keyboard.
12
+ */
13
+ static dismiss = () => {
14
+ Keyboard.dismiss();
15
+ TextInputKeyboardManager.dismissKeyboard();
16
+ };
17
+ }
@@ -1,4 +1,4 @@
1
- const EventEmitterManager = require('../index').default;
1
+ const EventEmitterManager = require('../EventEmitterManager').default;
2
2
 
3
3
  let EventEmitter;
4
4
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { KeyboardTrackingViewProps } from '../KeyboardTrackingView';
2
+ import { KeyboardTrackingViewProps } from './KeyboardTrackingView';
3
3
  type Props = KeyboardTrackingViewProps & {
4
4
  offset?: number;
5
5
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { StyleSheet, Dimensions } from 'react-native';
3
- import KeyboardTrackingView from "../KeyboardTrackingView";
3
+ import KeyboardTrackingView from "./KeyboardTrackingView";
4
4
  /**
5
5
  * @description: Used to add an inset when a keyboard is used and might hide part of the screen.
6
6
  *
@@ -1,7 +1,10 @@
1
+ /**
2
+ * Created by artald on 15/05/2016.
3
+ */
1
4
  import React, { PureComponent } from 'react';
2
5
  import { KeyboardTrackingViewProps } from './index';
3
6
  /**
4
- * @description: A UI component that enables "keyboard tracking" for this view and it's sub-views.
7
+ * @description: A UI component that enables keyboard tracking" for this view and it's sub-views.
5
8
  * Would typically be used when you have a TextField or TextInput inside this view.
6
9
  *
7
10
  * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js
@@ -1,11 +1,14 @@
1
+ /**
2
+ * Created by artald on 15/05/2016.
3
+ */
4
+
1
5
  import React, { PureComponent } from 'react';
2
- import ReactNative, { NativeModules } from 'react-native';
3
- // Import the Codegen specification for New Architecture
4
- import KeyboardTrackingViewNativeComponent from "../../../specs/KeyboardTrackingViewNativeComponent";
6
+ import ReactNative, { requireNativeComponent, NativeModules } from 'react-native';
7
+ const NativeKeyboardTrackingView = requireNativeComponent('KeyboardTrackingViewTemp');
5
8
  const KeyboardTrackingViewTempManager = NativeModules.KeyboardTrackingViewTempManager;
6
9
 
7
10
  /**
8
- * @description: A UI component that enables "keyboard tracking" for this view and it's sub-views.
11
+ * @description: A UI component that enables keyboard tracking" for this view and it's sub-views.
9
12
  * Would typically be used when you have a TextField or TextInput inside this view.
10
13
  *
11
14
  * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js
@@ -18,7 +21,7 @@ class KeyboardTrackingView extends PureComponent {
18
21
  useSafeArea: false
19
22
  };
20
23
  render() {
21
- return <KeyboardTrackingViewNativeComponent {...this.props} ref={r => this.ref = r} />;
24
+ return <NativeKeyboardTrackingView {...this.props} ref={r => this.ref = r} />;
22
25
  }
23
26
  async getNativeProps() {
24
27
  if (this.ref && KeyboardTrackingViewTempManager && KeyboardTrackingViewTempManager.getNativeProps) {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { StyleProp, ViewStyle, ViewProps } from 'react-native';
2
+ import { ViewStyle, ViewProps } from 'react-native';
3
3
  declare const SCROLL_BEHAVIORS: {
4
4
  NONE: any;
5
5
  SCROLL_TO_BOTTOM_INVERTED_ONLY: any;
@@ -72,7 +72,7 @@ export type KeyboardTrackingViewProps = ViewProps & {
72
72
  */
73
73
  usesBottomTabs?: boolean;
74
74
  ref?: any;
75
- style?: StyleProp<ViewStyle>;
75
+ style?: ViewStyle;
76
76
  children?: React.ReactChild | React.ReactChild[];
77
77
  };
78
78
  declare const _default: React.ForwardRefExoticComponent<Omit<KeyboardTrackingViewProps, "ref"> & React.RefAttributes<unknown>> & {
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "KeyboardTrackingView",
3
3
  "category": "infra",
4
- "description": "A UI component that enables 'keyboard tracking' for this view and it's sub-views.\nWould typically be used when you have a TextField or TextInput inside this view",
5
- "note": "This view is useful only for iOS",
4
+ "description": "A UI component that enables 'keyboard tracking' for this view and it's sub-views.\nWould typically be used when you have a TextField or TextInput inside this view.",
5
+ "note": "This view is useful only for iOS.",
6
6
  "example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/KeyboardTrackingViewScreen.js",
7
7
  "images": [
8
8
  "https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardTrackingView/KeyboardTrackingView.gif?raw=true"
@@ -21,54 +21,63 @@
21
21
  {
22
22
  "name": "scrollBehavior",
23
23
  "type": "number",
24
- "description": "The scrolling behavior (use KeyboardTrackingView.scrollBehaviors.NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)"
24
+ "description": "The scrolling behavior (use KeyboardTrackingView.scrollBehaviors.NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)",
25
+ "note": "iOS only"
25
26
  },
26
27
  {
27
28
  "name": "revealKeyboardInteractive",
28
29
  "type": "boolean",
29
- "description": "Show the keyboard on a negative scroll",
30
+ "description": "Show the keyboard on a negative scroll.",
31
+ "note": "iOS only",
30
32
  "default": "false"
31
33
  },
32
34
  {
33
35
  "name": "manageScrollView",
34
36
  "type": "boolean",
35
- "description": "Set to false to turn off inset management and manage it yourself",
37
+ "description": "Set to false to turn off inset management and manage it yourself.",
38
+ "note": "iOS only",
36
39
  "default": "true"
37
40
  },
38
41
  {
39
42
  "name": "requiresSameParentToManageScrollView",
40
43
  "type": "boolean",
41
- "description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true",
44
+ "description": "Set to true manageScrollView is set to true and still does not work,\nit means that the ScrollView found is the wrong one and you'll have\nto have the KeyboardAccessoryView and the ScrollView as siblings\nand set this to true.",
45
+ "note": "iOS only",
42
46
  "default": "false"
43
47
  },
44
48
  {
45
49
  "name": "allowHitsOutsideBounds",
46
50
  "type": "boolean",
47
- "description": "Allow hitting sub-views that are placed beyond the view bounds",
51
+ "description": "Allow hitting sub-views that are placed beyond the view bounds.",
52
+ "note": "iOS only",
48
53
  "default": "false"
49
54
  },
50
55
  {
51
56
  "name": "addBottomView",
52
57
  "type": "boolean",
53
- "description": "Add a view beneath the KeyboardAccessoryView",
58
+ "description": "Add a view beneath the KeyboardAccessoryView.",
59
+ "note": "iOS only",
54
60
  "default": "false"
55
61
  },
56
62
  {
57
63
  "name": "bottomViewColor",
58
64
  "type": "string",
59
- "description": "The bottom view's color",
65
+ "description": "The bottom view's color.",
66
+ "note": "iOS only",
60
67
  "default": "white"
61
68
  },
62
69
  {
63
70
  "name": "useSafeArea",
64
71
  "type": "boolean",
65
- "description": "Whether or not to handle SafeArea",
72
+ "description": "Whether or not to handle SafeArea.",
73
+ "note": "iOS only",
66
74
  "default": "true"
67
75
  },
68
76
  {
69
77
  "name": "usesBottomTabs",
70
78
  "type": "boolean",
71
- "description": "Whether or not to include bottom tab bar inset",
79
+ "description": "Whether or not to include bottom tab bar inset.",
80
+ "note": "iOS only",
72
81
  "default": "false"
73
82
  },
74
83
  {"name": "ref", "type": "any", "description": ""},
@@ -1,8 +1,8 @@
1
1
  /// <reference types="react" />
2
- import { KeyboardTrackingViewProps } from './KeyboardTrackingView';
3
- import KeyboardAccessoryView, { KeyboardAccessoryViewProps } from './KeyboardAccessoryView';
4
- import KeyboardRegistry from './KeyboardAccessoryView/KeyboardRegistry';
5
- import KeyboardUtils from './KeyboardAccessoryView/KeyboardUtils';
2
+ import { KeyboardTrackingViewProps } from './KeyboardTracking/KeyboardTrackingView';
3
+ import KeyboardRegistry from './KeyboardInput/KeyboardRegistry';
4
+ import KeyboardAccessoryView, { KeyboardAccessoryViewProps } from './KeyboardInput/KeyboardAccessoryView';
5
+ import KeyboardUtils from './KeyboardInput/utils/KeyboardUtils';
6
6
  export { KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
7
7
  declare const _default: {
8
8
  KeyboardTrackingView: import("react").ForwardRefExoticComponent<Omit<KeyboardTrackingViewProps, "ref"> & import("react").RefAttributes<unknown>> & {
@@ -26,15 +26,15 @@ declare const _default: {
26
26
  useSafeArea?: boolean | undefined;
27
27
  usesBottomTabs?: boolean | undefined;
28
28
  ref?: any;
29
- style?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
29
+ style?: import("react-native/types").ViewStyle | undefined;
30
30
  children?: import("react").ReactChild | import("react").ReactChild[] | undefined;
31
31
  } & {
32
32
  offset?: number | undefined;
33
33
  }): import("react").JSX.Element;
34
34
  displayName: string;
35
35
  };
36
- KeyboardAccessoryView: typeof KeyboardAccessoryView;
37
36
  KeyboardRegistry: typeof KeyboardRegistry;
37
+ KeyboardAccessoryView: typeof KeyboardAccessoryView;
38
38
  KeyboardUtils: typeof KeyboardUtils;
39
39
  };
40
40
  export default _default;
@@ -1,13 +1,13 @@
1
- import KeyboardTrackingView, { KeyboardTrackingViewProps } from "./KeyboardTrackingView";
2
- import KeyboardAwareInsetsView from "./KeyboardAwareInsetsView";
3
- import KeyboardAccessoryView, { KeyboardAccessoryViewProps } from "./KeyboardAccessoryView";
4
- import KeyboardRegistry from "./KeyboardAccessoryView/KeyboardRegistry";
5
- import KeyboardUtils from "./KeyboardAccessoryView/KeyboardUtils";
1
+ import KeyboardTrackingView, { KeyboardTrackingViewProps } from "./KeyboardTracking/KeyboardTrackingView";
2
+ import KeyboardAwareInsetsView from "./KeyboardTracking/KeyboardAwareInsetsView";
3
+ import KeyboardRegistry from "./KeyboardInput/KeyboardRegistry";
4
+ import KeyboardAccessoryView, { KeyboardAccessoryViewProps } from "./KeyboardInput/KeyboardAccessoryView";
5
+ import KeyboardUtils from "./KeyboardInput/utils/KeyboardUtils";
6
6
  export { KeyboardTrackingViewProps, KeyboardAccessoryViewProps };
7
7
  export default {
8
8
  KeyboardTrackingView,
9
9
  KeyboardAwareInsetsView,
10
- KeyboardAccessoryView,
11
10
  KeyboardRegistry,
11
+ KeyboardAccessoryView,
12
12
  KeyboardUtils
13
13
  };
@@ -1,34 +1,20 @@
1
- export type SafeAreaInsetsType = {
1
+ type SafeAreaInsetsType = {
2
2
  top: number;
3
3
  left: number;
4
4
  bottom: number;
5
5
  right: number;
6
6
  } | null;
7
- export type SafeAreaChangedDelegateType = {
8
- onSafeAreaInsetsDidChangeEvent?: (insets: SafeAreaInsetsType) => void;
9
- };
10
- export declare const DEFAULT_INSETS: {
11
- top: number;
12
- left: number;
13
- bottom: number;
14
- right: number;
15
- };
16
7
  declare class SafeAreaInsetsManager {
17
8
  _defaultInsets: SafeAreaInsetsType;
18
9
  _safeAreaInsets: SafeAreaInsetsType;
19
- _safeAreaChangedDelegates: Array<SafeAreaChangedDelegateType>;
20
- _nativeModule: any;
10
+ _safeAreaChangedDelegates: Array<any>;
21
11
  constructor();
22
- setupNativeConnection(): void;
23
- setupEventListener(): void;
24
- getInitialInsets(): Promise<void>;
25
- notifyDelegates(insets: SafeAreaInsetsType): void;
12
+ addSafeAreaChangedListener(): void;
26
13
  _updateInsets(): Promise<void>;
27
14
  getSafeAreaInsets(): Promise<SafeAreaInsetsType>;
28
- addSafeAreaChangedDelegate(delegate: SafeAreaChangedDelegateType): void;
29
- removeSafeAreaChangedDelegate(delegateToRemove: SafeAreaChangedDelegateType): void;
15
+ addSafeAreaChangedDelegate(delegate: any): void;
16
+ removeSafeAreaChangedDelegate(delegateToRemove: any): void;
30
17
  get defaultInsets(): SafeAreaInsetsType;
31
- refreshSafeAreaInsets(): Promise<void>;
32
18
  }
33
- declare const instance: SafeAreaInsetsManager;
34
- export default instance;
19
+ declare const _default: SafeAreaInsetsManager;
20
+ export default _default;
@@ -1,99 +1,48 @@
1
- import _isEqual from "lodash/isEqual";
2
1
  import _remove from "lodash/remove";
3
2
  import _forEach from "lodash/forEach";
4
3
  /* eslint no-underscore-dangle: 0 */
5
- import { NativeModules, DeviceEventEmitter } from 'react-native';
6
- export const DEFAULT_INSETS = {
7
- top: 47,
8
- left: 0,
9
- bottom: 34,
10
- right: 0
11
- };
4
+
5
+ import { NativeModules, NativeEventEmitter } from 'react-native';
12
6
  let SafeAreaInsetsCache = null;
7
+ const NativeSafeAreaManager = NativeModules.SafeAreaManager;
13
8
  class SafeAreaInsetsManager {
14
- _defaultInsets = DEFAULT_INSETS; // Common iPhone safe area values
15
-
9
+ _defaultInsets = {
10
+ top: 0,
11
+ left: 0,
12
+ bottom: 0,
13
+ right: 0
14
+ };
15
+ _safeAreaInsets = {
16
+ top: 0,
17
+ left: 0,
18
+ bottom: 0,
19
+ right: 0
20
+ };
16
21
  _safeAreaChangedDelegates = [];
17
- _nativeModule = null;
18
22
  constructor() {
19
- // Initialize with default values
20
- this._safeAreaInsets = this._defaultInsets;
21
-
22
- // Try to connect to native module
23
- this.setupNativeConnection();
23
+ this.addSafeAreaChangedListener();
24
24
  }
25
- setupNativeConnection() {
26
- try {
27
- // Access the native module directly without causing getConstants
28
- this._nativeModule = NativeModules.SafeAreaManager;
29
- if (this._nativeModule) {
30
- // Set up event listener using DeviceEventEmitter instead of NativeEventEmitter
31
- // This avoids getConstants issues
32
- this.setupEventListener();
33
-
34
- // Get initial safe area insets
35
- this.getInitialInsets();
36
- } else {
37
- console.log('SafeAreaInsetsManager: Native SafeAreaManager not available, using defaults');
38
- }
39
- } catch (error) {
40
- console.warn('SafeAreaInsetsManager: Failed to connect to native module:', error);
25
+ addSafeAreaChangedListener() {
26
+ if (!NativeSafeAreaManager) {
27
+ return;
41
28
  }
42
- }
43
- setupEventListener() {
44
- try {
45
- // Use DeviceEventEmitter instead of NativeEventEmitter to avoid getConstants
46
- DeviceEventEmitter.addListener('SafeAreaInsetsDidChangeEvent', data => {
47
- if (data) {
48
- SafeAreaInsetsCache = data;
49
- this._safeAreaInsets = data;
50
- this.notifyDelegates(data);
29
+ const NativeSafeAreaEvents = new NativeEventEmitter(NativeSafeAreaManager);
30
+ NativeSafeAreaEvents.addListener('SafeAreaInsetsDidChangeEvent', safeAreaInsets => {
31
+ SafeAreaInsetsCache = safeAreaInsets;
32
+ this._safeAreaInsets = SafeAreaInsetsCache;
33
+ _forEach(this._safeAreaChangedDelegates, delegate => {
34
+ if (delegate.onSafeAreaInsetsDidChangeEvent) {
35
+ delegate.onSafeAreaInsetsDidChangeEvent(this._safeAreaInsets);
36
+ } else {
37
+ console.warn('ERROR', 'SafeAreaInsetsManager', 'safe area changed delegate was added, but it does not implement the onSafeAreaInsetsDidChangeEvent method'); //eslint-disable-line
51
38
  }
52
39
  });
53
- } catch (error) {
54
- console.warn('SafeAreaInsetsManager: Failed to setup event listener:', error);
55
- }
56
- }
57
- async getInitialInsets() {
58
- if (!this._nativeModule) {
59
- return;
60
- }
61
- try {
62
- const insets = await this._nativeModule.getSafeAreaInsets();
63
- if (insets) {
64
- SafeAreaInsetsCache = insets;
65
- this._safeAreaInsets = insets;
66
- // Don't notify delegates yet as components might not be ready
67
- }
68
- } catch (error) {
69
- console.warn('SafeAreaInsetsManager: Failed to get initial insets:', error);
70
- }
71
- }
72
- notifyDelegates(insets) {
73
- _forEach(this._safeAreaChangedDelegates, delegate => {
74
- if (delegate.onSafeAreaInsetsDidChangeEvent) {
75
- delegate.onSafeAreaInsetsDidChangeEvent(insets);
76
- }
77
40
  });
78
41
  }
79
42
  async _updateInsets() {
80
- if (this._nativeModule && SafeAreaInsetsCache === null) {
81
- try {
82
- const insets = await this._nativeModule.getSafeAreaInsets();
83
- if (insets) {
84
- SafeAreaInsetsCache = insets;
85
- this._safeAreaInsets = SafeAreaInsetsCache;
86
- } else {
87
- this._safeAreaInsets = this._defaultInsets;
88
- }
89
- } catch (error) {
90
- console.warn('SafeAreaInsetsManager: Failed to get native insets:', error);
91
- this._safeAreaInsets = this._defaultInsets;
92
- }
93
- } else if (SafeAreaInsetsCache !== null) {
43
+ if (NativeSafeAreaManager && SafeAreaInsetsCache === null) {
44
+ SafeAreaInsetsCache = await NativeSafeAreaManager.getSafeAreaInsets();
94
45
  this._safeAreaInsets = SafeAreaInsetsCache;
95
- } else {
96
- this._safeAreaInsets = this._defaultInsets;
97
46
  }
98
47
  }
99
48
  async getSafeAreaInsets() {
@@ -111,18 +60,5 @@ class SafeAreaInsetsManager {
111
60
  get defaultInsets() {
112
61
  return this._defaultInsets;
113
62
  }
114
-
115
- // Method to manually refresh safe area insets and notify delegates
116
- async refreshSafeAreaInsets() {
117
- const previousInsets = this._safeAreaInsets;
118
- SafeAreaInsetsCache = null; // Force refresh
119
- await this._updateInsets();
120
-
121
- // Notify delegates if insets changed
122
- if (!_isEqual(previousInsets, this._safeAreaInsets)) {
123
- this.notifyDelegates(this._safeAreaInsets);
124
- }
125
- }
126
63
  }
127
- const instance = new SafeAreaInsetsManager();
128
- export default instance;
64
+ export default new SafeAreaInsetsManager();