react-native-ui-lib 7.46.2-snapshot.7314 → 7.46.2-snapshot.7316

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 (199) 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 +1 -1
  52. package/lib/react-native.config.js +3 -1
  53. package/metro.config.js +2 -2
  54. package/package.json +24 -24
  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/badge/index.d.ts +47 -107
  65. package/src/components/button/button.api.json +6 -1
  66. package/src/components/button/index.d.ts +31 -53
  67. package/src/components/button/index.js +18 -1
  68. package/src/components/button/types.d.ts +5 -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/modal/index.d.ts +0 -5
  86. package/src/components/modal/index.js +10 -14
  87. package/src/components/modal/modal.api.json +0 -5
  88. package/src/components/panningViews/asPanViewConsumer.d.ts +3 -0
  89. package/src/components/panningViews/asPanViewConsumer.js +16 -0
  90. package/src/components/panningViews/panDismissibleView.d.ts +51 -0
  91. package/src/components/panningViews/panDismissibleView.js +350 -0
  92. package/src/components/panningViews/panGestureView.d.ts +23 -0
  93. package/src/components/panningViews/panGestureView.js +156 -0
  94. package/src/components/panningViews/panListenerView.d.ts +66 -0
  95. package/src/components/panningViews/panListenerView.js +155 -0
  96. package/src/components/panningViews/panResponderView.d.ts +19 -0
  97. package/src/components/panningViews/panResponderView.js +79 -0
  98. package/src/components/panningViews/panningContext.d.ts +3 -0
  99. package/src/components/panningViews/panningContext.js +4 -0
  100. package/src/components/panningViews/panningProvider.d.ts +73 -0
  101. package/src/components/panningViews/panningProvider.js +101 -0
  102. package/src/components/picker/Picker.driver.new.d.ts +2 -2
  103. package/src/components/picker/Picker.driver.new.js +3 -3
  104. package/src/components/picker/PickerItem.js +20 -6
  105. package/src/components/picker/PickerPresenter.d.ts +1 -0
  106. package/src/components/picker/PickerPresenter.js +23 -1
  107. package/src/components/picker/api/picker.api.json +1 -0
  108. package/src/components/picker/api/pickerItem.api.json +5 -0
  109. package/src/components/picker/helpers/useFieldType.d.ts +23 -53
  110. package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
  111. package/src/components/picker/helpers/usePickerLabel.js +3 -2
  112. package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
  113. package/src/components/picker/helpers/usePickerMigrationWarnings.js +12 -0
  114. package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
  115. package/src/components/picker/helpers/usePickerSearch.js +8 -4
  116. package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
  117. package/src/components/picker/helpers/usePickerSelection.js +10 -2
  118. package/src/components/picker/index.js +22 -4
  119. package/src/components/picker/types.d.ts +24 -1
  120. package/src/components/segmentedControl/index.js +3 -3
  121. package/src/components/sharedTransition/ShareTransitionContext.js +3 -0
  122. package/src/components/sharedTransition/SharedArea.js +153 -0
  123. package/src/components/sharedTransition/SourceElement.js +44 -0
  124. package/src/components/sharedTransition/TargetElement.js +38 -0
  125. package/src/components/sharedTransition/index.js +9 -0
  126. package/src/components/slider/GradientSlider.d.ts +1 -1
  127. package/src/components/sortableGridList/SortableItem.js +4 -13
  128. package/src/components/sortableList/SortableListItem.js +4 -13
  129. package/src/components/stackAggregator/index.js +11 -16
  130. package/src/components/text/Text.driver.new.d.ts +2 -2
  131. package/src/components/text/Text.driver.new.js +2 -2
  132. package/src/components/textField/Input.js +1 -0
  133. package/src/components/textField/TextField.driver.new.d.ts +2 -2
  134. package/src/components/textField/TextField.driver.new.js +2 -2
  135. package/src/components/textField/presets/outline.d.ts +46 -106
  136. package/src/components/textField/presets/underline.d.ts +46 -106
  137. package/src/components/textField/usePreset.d.ts +44 -72
  138. package/src/incubator/dialog/dialog.api.json +54 -0
  139. package/src/{components → incubator}/dialog/dialogHeader.api.json +2 -2
  140. package/src/incubator/dialog/index.d.ts +15 -0
  141. package/src/incubator/dialog/index.js +218 -0
  142. package/src/{components → incubator}/dialog/types.d.ts +19 -0
  143. package/src/{components → incubator}/dialog/types.js +3 -1
  144. package/src/{components → incubator}/dialog/useDialogContent.d.ts +1 -1
  145. package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
  146. package/src/incubator/expandableOverlay/index.d.ts +3 -42
  147. package/src/incubator/expandableOverlay/index.js +4 -1
  148. package/src/{hooks/useHiddenLocation/index.d.ts → incubator/hooks/useHiddenLocation.d.ts} +1 -1
  149. package/src/{hooks/useHiddenLocation/index.web.d.ts → incubator/hooks/useHiddenLocation.web.d.ts} +1 -1
  150. package/src/incubator/index.d.ts +2 -0
  151. package/src/incubator/index.js +2 -0
  152. package/src/{components → incubator}/panView/index.d.ts +3 -3
  153. package/src/{components → incubator}/panView/index.js +4 -4
  154. package/src/{components → incubator}/panView/usePanGesture.d.ts +1 -1
  155. package/src/incubator/toast/index.js +1 -1
  156. package/src/index.d.ts +10 -3
  157. package/src/index.js +160 -41
  158. package/src/testkit/index.d.ts +1 -1
  159. package/src/testkit/index.js +1 -1
  160. package/src/testkit/new/Component.driver.d.ts +1 -4
  161. package/src/testkit/new/Component.driver.js +3 -3
  162. package/lib/components/HighlighterOverlayView/index.js +0 -49
  163. package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +0 -51
  164. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +0 -26
  165. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +0 -91
  166. package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +0 -274
  167. package/lib/components/SafeArea/index.d.ts +0 -10
  168. package/lib/components/SafeArea/index.js +0 -11
  169. package/panView.d.ts +0 -2
  170. package/panView.js +0 -1
  171. /package/lib/components/{HighlighterOverlayView/index.web.js → HighlighterOverlayView.web.js} +0 -0
  172. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.d.ts +0 -0
  173. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.js +0 -0
  174. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.d.ts +0 -0
  175. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.js +0 -0
  176. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
  177. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
  178. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
  179. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
  180. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.d.ts +0 -0
  181. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.js +0 -0
  182. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts → KeyboardInput/utils/EventEmitterManager.d.ts} +0 -0
  183. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js → KeyboardInput/utils/EventEmitterManager.js} +0 -0
  184. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
  185. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
  186. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.js +0 -0
  187. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.d.ts +0 -0
  188. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.js +0 -0
  189. /package/lib/components/Keyboard/{KeyboardAwareInsetsView → KeyboardTracking}/keyboardAwareInsetsView.api.json +0 -0
  190. /package/src/{components → incubator}/dialog/Dialog.driver.new.d.ts +0 -0
  191. /package/src/{components → incubator}/dialog/Dialog.driver.new.js +0 -0
  192. /package/src/{components → incubator}/dialog/DialogHeader.d.ts +0 -0
  193. /package/src/{components → incubator}/dialog/DialogHeader.js +0 -0
  194. /package/src/{components → incubator}/dialog/useDialogContent.js +0 -0
  195. /package/src/{hooks/useHiddenLocation/index.js → incubator/hooks/useHiddenLocation.js} +0 -0
  196. /package/src/{hooks/useHiddenLocation/index.web.js → incubator/hooks/useHiddenLocation.web.js} +0 -0
  197. /package/src/{components → incubator}/panView/panningUtil.d.ts +0 -0
  198. /package/src/{components → incubator}/panView/panningUtil.js +0 -0
  199. /package/src/{components → incubator}/panView/usePanGesture.js +0 -0
package/babel.config.js CHANGED
@@ -1,17 +1,5 @@
1
1
  module.exports = {
2
2
  presets: ['module:@react-native/babel-preset'],
3
- env: {
4
- test: {
5
- presets: [
6
- [
7
- 'module:@react-native/babel-preset',
8
- {
9
- disableStaticViewConfigsCodegen: true
10
- }
11
- ]
12
- ]
13
- }
14
- },
15
3
  plugins: [
16
4
  'react-native-reanimated/plugin',
17
5
  [
package/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import 'setimmediate';
2
1
  require('./demo/src/index');
3
2
  require('./demo/src/demoApp'); // this is separated from demo/src/index by purpose
4
3
 
@@ -1,11 +1,11 @@
1
1
  apply plugin: 'com.android.library'
2
2
 
3
3
  project.ext {
4
- buildToolsVersion = rootProject.ext.has("buildToolsVersion") ? rootProject.ext.buildToolsVersion : '35.0.0'
5
- minSdkVersion = rootProject.ext.has("minSdkVersion") ? rootProject.ext.minSdkVersion : 24
6
- compileSdkVersion = rootProject.ext.has("compileSdkVersion") ? rootProject.ext.compileSdkVersion : 35
7
- targetSdkVersion = rootProject.ext.has("targetSdkVersion") ? rootProject.ext.targetSdkVersion : 34
8
- supportLibVersion = rootProject.ext.has("supportLibVersion") ? rootProject.ext.supportLibVersion : '28.0.0'
4
+ buildToolsVersion = rootProject.ext.has("buildToolsVersion") ? rootProject.ext.buildToolsVersion : '27.0.3'
5
+ minSdkVersion = rootProject.ext.has("minSdkVersion") ? rootProject.ext.minSdkVersion : 19
6
+ compileSdkVersion = rootProject.ext.has("compileSdkVersion") ? rootProject.ext.compileSdkVersion : 27
7
+ targetSdkVersion = rootProject.ext.has("targetSdkVersion") ? rootProject.ext.targetSdkVersion : 25
8
+ supportLibVersion = rootProject.ext.has("supportLibVersion") ? rootProject.ext.supportLibVersion : '27.1.1'
9
9
  }
10
10
 
11
11
  android {
@@ -6,6 +6,7 @@ import com.facebook.react.ReactPackage;
6
6
  import com.wix.reactnativeuilib.dynamicfont.DynamicFontPackage;
7
7
  import com.wix.reactnativeuilib.highlighterview.HighlighterViewPackage;
8
8
  import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;
9
+ import com.wix.reactnativeuilib.textinput.TextInputDelKeyHandlerPackage;
9
10
 
10
11
  import java.util.Arrays;
11
12
  import java.util.List;
@@ -22,6 +23,7 @@ public class UiLibPackageList {
22
23
  return Arrays.asList(
23
24
  new DynamicFontPackage(),
24
25
  new HighlighterViewPackage(),
26
+ new TextInputDelKeyHandlerPackage(),
25
27
  new KeyboardInputPackage(application)
26
28
  );
27
29
  }
@@ -8,15 +8,12 @@ import android.util.SizeF;
8
8
  import android.view.View;
9
9
 
10
10
  import com.facebook.react.bridge.ReadableMap;
11
- import com.facebook.react.bridge.UIManager;
12
11
  import com.facebook.react.uimanager.IllegalViewOperationException;
13
12
  import com.facebook.react.uimanager.NativeViewHierarchyManager;
14
13
  import com.facebook.react.uimanager.SimpleViewManager;
15
14
  import com.facebook.react.uimanager.ThemedReactContext;
16
- import com.facebook.react.uimanager.UIManagerHelper;
17
15
  import com.facebook.react.uimanager.UIManagerModule;
18
16
  import com.facebook.react.uimanager.annotations.ReactProp;
19
- import com.facebook.react.uimanager.common.UIManagerType;
20
17
 
21
18
  import javax.annotation.Nullable;
22
19
 
@@ -78,38 +75,33 @@ class HighlighterViewManager extends SimpleViewManager<HighlighterView> {
78
75
 
79
76
  @ReactProp(name = "highlightViewTag")
80
77
  public void setHighlightViewTag(final HighlighterView view, Integer highlightViewTag) {
81
- if (highlightViewTag != null) {
82
- try {
83
- UIManager uiManager = UIManagerHelper.getUIManagerForReactTag(context, highlightViewTag);
84
- if (uiManager != null) {
85
- final View resolvedView = uiManager.resolveView(highlightViewTag);
86
- if (resolvedView != null) {
87
- if (resolvedView.getWidth() == 0 || resolvedView.getHeight() == 0) {
88
- resolvedView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
89
- @Override
90
- public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
91
- float width = right - left;
92
- float height = bottom - top;
93
- if (width > 0 && height > 0) {
94
- setViewBasedHighlightFrame(view, resolvedView);
95
- resolvedView.removeOnLayoutChangeListener(this);
96
- }
97
- }
98
- });
99
- } else {
100
- setViewBasedHighlightFrame(view, resolvedView);
78
+ try {
79
+ NativeViewHierarchyManager nativeViewHierarchyManager = ReactHacks.getNativeViewHierarchyManager(context.getNativeModule(UIManagerModule.class));
80
+ if (nativeViewHierarchyManager == null) {
81
+ return;
82
+ }
83
+
84
+ final View resolvedView = nativeViewHierarchyManager.resolveView(highlightViewTag);
85
+ if (resolvedView != null) {
86
+ if (resolvedView.getWidth() == 0 || resolvedView.getHeight() == 0) {
87
+ resolvedView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
88
+ @Override
89
+ public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
90
+ float width = right - left;
91
+ float height = bottom - top;
92
+ if (width > 0 && height > 0) {
93
+ setViewBasedHighlightFrame(view, resolvedView);
94
+ resolvedView.removeOnLayoutChangeListener(this);
95
+ }
101
96
  }
102
- } else {
103
- Log.e("HighlighterView", "was not able to resolve highlightViewTag: " + highlightViewTag.toString());
104
- }
97
+ });
105
98
  } else {
106
- Log.e("HighlighterView", "was not able to resolve get uiManager for highlightViewTag: " + highlightViewTag.toString());
99
+ setViewBasedHighlightFrame(view, resolvedView);
107
100
  }
108
- } catch (IllegalViewOperationException e) {
109
- Log.e("HighlighterView", "invalid highlightViewTag: " + highlightViewTag.toString() + " " + e.toString());
110
101
  }
111
- } else {
112
- Log.e("HighlighterView", "highlightViewTag is null");
102
+ }
103
+ catch (IllegalViewOperationException e) {
104
+ Log.e("HighlighterView", "invalid highlightViewTag: " + highlightViewTag.toString() + " " + e.toString());
113
105
  }
114
106
  }
115
107
 
@@ -0,0 +1,30 @@
1
+ package com.wix.reactnativeuilib.highlighterview;
2
+
3
+
4
+ import androidx.annotation.Nullable;
5
+
6
+ import com.facebook.react.uimanager.NativeViewHierarchyManager;
7
+ import com.facebook.react.uimanager.UIBlock;
8
+ import com.facebook.react.uimanager.UIManagerModule;
9
+ import com.facebook.react.uimanager.UIViewOperationQueue;
10
+
11
+ /**
12
+ * ¯\_(ツ)_/¯
13
+ */
14
+ public class ReactHacks {
15
+
16
+ /**
17
+ * {@link NativeViewHierarchyManager} is used to resolve a native view by RN tag ({@link NativeViewHierarchyManager#resolveView}). The only way of obtaining it is by
18
+ * posting {@link UIBlock} which can take a noticeable amount of time to execute.
19
+ */
20
+ @Nullable
21
+ public static NativeViewHierarchyManager getNativeViewHierarchyManager(UIManagerModule uiManager) {
22
+ try {
23
+ UIViewOperationQueue mOperationsQueue = (UIViewOperationQueue) ReflectionUtils.getDeclaredField(uiManager.getUIImplementation(), "mOperationsQueue");
24
+ return (NativeViewHierarchyManager) ReflectionUtils.getDeclaredField(mOperationsQueue, "mNativeViewHierarchyManager");
25
+ } catch (Exception e) {
26
+ e.printStackTrace();
27
+ return null;
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,34 @@
1
+ package com.wix.reactnativeuilib.highlighterview;
2
+
3
+
4
+ import androidx.annotation.Nullable;
5
+
6
+ import java.lang.reflect.Field;
7
+
8
+ class ReflectionUtils {
9
+
10
+ @Nullable
11
+ static Object getDeclaredField(Object obj, String fieldName) {
12
+ try {
13
+ Field f = getField(obj.getClass(), fieldName);
14
+ if (f == null) {
15
+ return null;
16
+ }
17
+ f.setAccessible(true);
18
+ return f.get(obj);
19
+ } catch (Exception e) {
20
+ e.printStackTrace();
21
+ }
22
+ return null;
23
+ }
24
+
25
+ private static Field getField(Class clazz, String name) {
26
+ try {
27
+ return clazz.getDeclaredField(name);
28
+ } catch (NoSuchFieldException nsfe) {
29
+ return getField(clazz.getSuperclass(), name);
30
+ } catch (Exception e) {
31
+ return null;
32
+ }
33
+ }
34
+ }
@@ -9,7 +9,7 @@ public class RuntimeUtils {
9
9
  private static final Runnable sUIUpdateClosure = new Runnable() {
10
10
  @Override
11
11
  public void run() {
12
- // ReactContextHolder.getContext().getNativeModule(UIManagerModule.class).onBatchComplete();
12
+ ReactContextHolder.getContext().getNativeModule(UIManagerModule.class).onBatchComplete();
13
13
  }
14
14
  };
15
15
 
@@ -0,0 +1,33 @@
1
+ package com.wix.reactnativeuilib.textinput;
2
+
3
+ import android.text.Editable;
4
+ import android.text.InputType;
5
+ import android.text.method.KeyListener;
6
+ import android.view.KeyEvent;
7
+ import android.view.View;
8
+
9
+ class DefaultKeyListener implements KeyListener {
10
+ @Override
11
+ public int getInputType() {
12
+ return InputType.TYPE_NULL;
13
+ }
14
+
15
+ @Override
16
+ public boolean onKeyDown(View view, Editable text, int keyCode, KeyEvent event) {
17
+ return false;
18
+ }
19
+
20
+ @Override
21
+ public boolean onKeyUp(View view, Editable text, int keyCode, KeyEvent event) {
22
+ return false;
23
+ }
24
+
25
+ @Override
26
+ public boolean onKeyOther(View view, Editable text, KeyEvent event) {
27
+ return false;
28
+ }
29
+
30
+ @Override
31
+ public void clearMetaKeyState(View view, Editable content, int states) {
32
+ }
33
+ }
@@ -0,0 +1,53 @@
1
+ package com.wix.reactnativeuilib.textinput;
2
+
3
+ import android.text.Editable;
4
+ import android.text.method.KeyListener;
5
+ import android.view.KeyEvent;
6
+ import android.view.View;
7
+
8
+ import com.facebook.react.bridge.Arguments;
9
+ import com.facebook.react.bridge.ReactApplicationContext;
10
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
11
+
12
+ public class KeyListenerProxy implements KeyListener {
13
+
14
+ final private ReactApplicationContext mContext;
15
+ final private KeyListener mKeyListener;
16
+
17
+ KeyListenerProxy(ReactApplicationContext context, KeyListener keyListener) {
18
+ mContext = context;
19
+ mKeyListener = keyListener == null ? new DefaultKeyListener() : keyListener;
20
+ }
21
+
22
+ @Override
23
+ public int getInputType() {
24
+ return mKeyListener.getInputType();
25
+ }
26
+
27
+ @Override
28
+ public boolean onKeyDown(View view, Editable text, int keyCode, KeyEvent event) {
29
+ return mKeyListener.onKeyDown(view, text, keyCode, event);
30
+ }
31
+
32
+ @Override
33
+ public boolean onKeyUp(View view, Editable text, int keyCode, KeyEvent event) {
34
+ if (keyCode == KeyEvent.KEYCODE_DEL) {
35
+ emitBackspacePressEvent();
36
+ }
37
+ return mKeyListener.onKeyUp(view, text, keyCode, event);
38
+ }
39
+
40
+ @Override
41
+ public boolean onKeyOther(View view, Editable text, KeyEvent event) {
42
+ return mKeyListener.onKeyOther(view, text, event);
43
+ }
44
+
45
+ @Override
46
+ public void clearMetaKeyState(View view, Editable content, int states) {
47
+ mKeyListener.clearMetaKeyState(view, content, states);
48
+ }
49
+
50
+ private void emitBackspacePressEvent() {
51
+ mContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class).emit("onBackspacePress", Arguments.createMap());
52
+ }
53
+ }
@@ -0,0 +1,54 @@
1
+ package com.wix.reactnativeuilib.textinput;
2
+
3
+ import android.util.Log;
4
+ import android.view.View;
5
+
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
8
+ import com.facebook.react.bridge.ReactMethod;
9
+ import com.facebook.react.uimanager.IllegalViewOperationException;
10
+ import com.facebook.react.uimanager.NativeViewHierarchyManager;
11
+ import com.facebook.react.uimanager.UIBlock;
12
+ import com.facebook.react.uimanager.UIManagerModule;
13
+ import com.facebook.react.views.textinput.ReactEditText;
14
+
15
+ public class TextInputDelKeyHandlerModule extends ReactContextBaseJavaModule {
16
+
17
+ private final static String REACT_CLASS = "TextInputDelKeyHandler";
18
+
19
+ TextInputDelKeyHandlerModule(ReactApplicationContext reactContext) {
20
+ super(reactContext);
21
+ }
22
+
23
+ @Override
24
+ public String getName() {
25
+ return REACT_CLASS;
26
+ }
27
+
28
+ @ReactMethod
29
+ public void register(final Integer textInputTag) {
30
+ final ReactApplicationContext reactContext = this.getReactApplicationContext();
31
+ final UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
32
+
33
+ uiManager.addUIBlock(new UIBlock() {
34
+ public void execute(NativeViewHierarchyManager viewHierarchyManager) {
35
+ Log.d("ReactNativeJS","registering tag = " + textInputTag);
36
+ final View view;
37
+ try {
38
+ view = viewHierarchyManager.resolveView(textInputTag);
39
+ } catch (IllegalViewOperationException e) {
40
+ Log.d("ReactNativeJS","no view for tag = " + textInputTag);
41
+ e.printStackTrace();
42
+ return;
43
+ }
44
+ final ReactEditText editText = ViewUtils.getEditTextInView(view);
45
+
46
+ if (editText != null) {
47
+ Log.d("ReactNativeJS","has editText for tag = " + textInputTag);
48
+ final KeyListenerProxy keyListenerProxy = new KeyListenerProxy(reactContext, editText.getKeyListener());
49
+ editText.setKeyListener(keyListenerProxy);
50
+ }
51
+ }
52
+ });
53
+ }
54
+ }
@@ -0,0 +1,28 @@
1
+ package com.wix.reactnativeuilib.textinput;
2
+
3
+ import com.facebook.react.ReactPackage;
4
+ import com.facebook.react.bridge.JavaScriptModule;
5
+ import com.facebook.react.bridge.NativeModule;
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.uimanager.ViewManager;
8
+
9
+ import java.util.Arrays;
10
+ import java.util.Collections;
11
+ import java.util.List;
12
+
13
+ public class TextInputDelKeyHandlerPackage implements ReactPackage {
14
+ @Override
15
+ public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
16
+ return Arrays.<NativeModule>asList(new TextInputDelKeyHandlerModule(reactContext));
17
+ }
18
+
19
+ // @Override
20
+ // public List<Class<? extends JavaScriptModule>> createJSModules() {
21
+ // return Collections.emptyList();
22
+ // }
23
+
24
+ @Override
25
+ public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
26
+ return Collections.emptyList();
27
+ }
28
+ }
@@ -0,0 +1,36 @@
1
+ package com.wix.reactnativeuilib.textinput;
2
+
3
+ import android.view.View;
4
+ import android.view.ViewGroup;
5
+
6
+ import androidx.annotation.Nullable;
7
+
8
+ import com.facebook.react.views.textinput.ReactEditText;
9
+
10
+ class ViewUtils {
11
+
12
+ @Nullable
13
+ static ReactEditText getEditTextInView(View view) {
14
+ if (view == null) {
15
+ return null;
16
+ }
17
+
18
+ if (view instanceof ReactEditText) {
19
+ return (ReactEditText) view;
20
+ }
21
+
22
+ if (view instanceof ViewGroup) {
23
+ final ViewGroup viewGroup = (ViewGroup) view;
24
+
25
+ for (int i = 0; i < viewGroup.getChildCount(); i++) {
26
+ final View child = viewGroup.getChildAt(i);
27
+ final View childView = getEditTextInView(child);
28
+
29
+ if (childView != null) {
30
+ return (ReactEditText) childView;
31
+ }
32
+ }
33
+ }
34
+ return null;
35
+ }
36
+ }
@@ -19,7 +19,7 @@ export type HighlighterOverlayViewProps = {
19
19
  onRequestClose?: () => void;
20
20
  highlightFrame?: HighlightFrameType;
21
21
  style?: ViewStyle;
22
- highlightViewTag?: number;
22
+ highlightViewTag?: number | null;
23
23
  children?: JSX.Element[] | JSX.Element;
24
24
  highlightViewTagParams?: HighlightViewTagParams;
25
25
  minimumRectSize?: Pick<HighlightFrameType, 'width' | 'height'>;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { requireNativeComponent, processColor, Platform, StyleSheet, Modal } from 'react-native';
3
+ const NativeHighlighterView = requireNativeComponent('HighlighterView');
4
+ const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
5
+ const HighlighterOverlayView = props => {
6
+ const {
7
+ overlayColor,
8
+ borderRadius,
9
+ strokeColor,
10
+ strokeWidth,
11
+ visible,
12
+ onRequestClose,
13
+ highlightFrame,
14
+ style,
15
+ children,
16
+ highlightViewTag,
17
+ highlightViewTagParams,
18
+ minimumRectSize,
19
+ innerPadding
20
+ } = props;
21
+ let overlayColorToUse = overlayColor || DefaultOverlayColor;
22
+ let strokeColorToUse = strokeColor;
23
+ if (Platform.OS === 'android') {
24
+ // @ts-ignore
25
+ overlayColorToUse = processColor(overlayColorToUse);
26
+ // @ts-ignore
27
+ strokeColorToUse = processColor(strokeColorToUse);
28
+ }
29
+ return <Modal visible={!!visible} animationType={'fade'} transparent onRequestClose={() => onRequestClose?.()}>
30
+ <NativeHighlighterView
31
+ // @ts-ignore, this became private, not sure if I should remove it
32
+ highlightFrame={highlightFrame} style={[style, {
33
+ ...StyleSheet.absoluteFillObject,
34
+ backgroundColor: 'transparent'
35
+ }]} overlayColor={overlayColorToUse} borderRadius={borderRadius} strokeColor={strokeColorToUse} strokeWidth={strokeWidth} highlightViewTag={highlightViewTag} highlightViewTagParams={highlightViewTagParams} minimumRectSize={minimumRectSize} innerPadding={innerPadding} />
36
+ {children}
37
+ </Modal>;
38
+ };
39
+ HighlighterOverlayView.displayName = 'IGNORE';
40
+ export default HighlighterOverlayView;
@@ -19,7 +19,7 @@ export type HighlighterOverlayViewProps = {
19
19
  onRequestClose?: () => void;
20
20
  highlightFrame?: HighlightFrameType;
21
21
  style?: ViewStyle;
22
- highlightViewTag?: number;
22
+ highlightViewTag?: number | null;
23
23
  children?: JSX.Element[] | JSX.Element;
24
24
  highlightViewTagParams?: HighlightViewTagParams;
25
25
  minimumRectSize?: Pick<HighlightFrameType, 'width' | 'height'>;
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
- import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from './CustomKeyboardViewBase';
2
+ import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from '../CustomKeyboardViewBase';
3
3
  export default class CustomKeyboardView extends CustomKeyboardViewBase<CustomKeyboardViewBaseProps> {
4
4
  static displayName: string;
5
5
  componentDidUpdate(prevProps: CustomKeyboardViewBaseProps): Promise<void>;
6
- getStyle: () => {
7
- height: number | undefined;
8
- };
9
- render(): React.JSX.Element | null;
6
+ render(): React.JSX.Element;
10
7
  }
@@ -0,0 +1,28 @@
1
+ import React from 'react';
2
+ import { requireNativeComponent } from 'react-native';
3
+ import TextInputKeyboardManager from "../TextInputKeyboardManager/TextInputKeyboardManager.android";
4
+ import KeyboardRegistry from "../KeyboardRegistry";
5
+ import CustomKeyboardViewBase from "../CustomKeyboardViewBase";
6
+ const CustomKeyboardViewNativeAndroid = requireNativeComponent('CustomKeyboardViewNativeTemp');
7
+ export default class CustomKeyboardView extends CustomKeyboardViewBase {
8
+ static displayName = 'IGNORE';
9
+ async componentDidUpdate(prevProps) {
10
+ const {
11
+ component
12
+ } = this.props;
13
+ if (prevProps.component !== component && !component) {
14
+ await TextInputKeyboardManager.reset();
15
+ }
16
+ super.componentDidUpdate(prevProps);
17
+ }
18
+ render() {
19
+ const {
20
+ component,
21
+ initialProps
22
+ } = this.props;
23
+ const KeyboardComponent = component && KeyboardRegistry.getKeyboard(component);
24
+ return <CustomKeyboardViewNativeAndroid>
25
+ {KeyboardComponent && <KeyboardComponent {...initialProps} />}
26
+ </CustomKeyboardViewNativeAndroid>;
27
+ }
28
+ }
@@ -1,4 +1,4 @@
1
- import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from './CustomKeyboardViewBase';
1
+ import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from './../CustomKeyboardViewBase';
2
2
  export type CustomKeyboardViewProps = CustomKeyboardViewBaseProps & {
3
3
  /**
4
4
  * The reference to the actual text input (or the keyboard may not reset when instructed to, etc.)
@@ -1,6 +1,6 @@
1
- import TextInputKeyboardManager from "../TextInputKeyboardManager/TextInputKeyboardManager.ios";
2
- import KeyboardRegistry from "../KeyboardRegistry";
3
- import CustomKeyboardViewBase from "./CustomKeyboardViewBase";
1
+ import TextInputKeyboardManager from "./../TextInputKeyboardManager/TextInputKeyboardManager.ios";
2
+ import KeyboardRegistry from "./../KeyboardRegistry";
3
+ import CustomKeyboardViewBase from "./../CustomKeyboardViewBase";
4
4
  export default class CustomKeyboardView extends CustomKeyboardViewBase {
5
5
  static displayName = 'IGNORE';
6
6
  static defaultProps = {
@@ -3,9 +3,6 @@ import { EventSubscription } from 'react-native';
3
3
  export type CustomKeyboardViewBaseProps = {
4
4
  inputRef?: any;
5
5
  initialProps?: any;
6
- keyboardHeight?: number;
7
- onKeyboardDismiss?: () => void;
8
- shouldFocus?: boolean;
9
6
  component?: string;
10
7
  onItemSelected?: (component?: string, args?: any) => void;
11
8
  onRequestShowKeyboard?: (keyboardId: string) => void;
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import KeyboardRegistry from "../KeyboardRegistry";
2
+ import KeyboardRegistry from "./KeyboardRegistry";
3
3
  export default class CustomKeyboardViewBase extends Component {
4
4
  static defaultProps = {
5
5
  initialProps: {}
@@ -1,6 +1,6 @@
1
1
  import React, { Component } from 'react';
2
2
  import { LayoutChangeEvent } from 'react-native';
3
- import { KeyboardTrackingViewProps } from '../KeyboardTrackingView';
3
+ import { KeyboardTrackingViewProps } from '../KeyboardTracking/KeyboardTrackingView';
4
4
  type kbTrackingViewProps = Pick<KeyboardTrackingViewProps, 'scrollBehavior' | 'revealKeyboardInteractive' | 'manageScrollView' | 'requiresSameParentToManageScrollView' | 'allowHitsOutsideBounds' | 'addBottomView' | 'bottomViewColor' | 'useSafeArea' | 'usesBottomTabs'>;
5
5
  export type KeyboardAccessoryViewProps = kbTrackingViewProps & {
6
6
  /**
@@ -58,16 +58,9 @@ declare class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps
58
58
  allowHitsOutsideBounds: boolean;
59
59
  scrollBehavior: any;
60
60
  };
61
- static currentId: number;
62
61
  customInputControllerEventsSubscriber: any;
63
62
  trackingViewRef: any;
64
- subscription: any;
65
- id: number;
66
63
  constructor(props: KeyboardAccessoryViewProps);
67
- state: {
68
- keyboardHeight: number;
69
- shouldFocus: boolean;
70
- };
71
64
  componentWillUnmount(): void;
72
65
  onContainerComponentHeightChanged(event: LayoutChangeEvent): void;
73
66
  onAndroidBackPressed(): boolean;
@@ -76,9 +69,6 @@ declare class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps
76
69
  registerAndroidBackHandler(): void;
77
70
  processInitialProps(): any;
78
71
  scrollToStart(): void;
79
- onKeyboardHeightChange: (keyboardHeight: number) => void;
80
- onDismiss: () => void;
81
- onKeyboardDismiss: () => void;
82
72
  render(): React.JSX.Element;
83
73
  }
84
74
  export default KeyboardAccessoryView;