uilib-native 3.0.4 → 3.0.8

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 (138) hide show
  1. package/android/build/.transforms/{6a4a003a5436f1cfa6c642f89a88b8f1.bin → 078d1206f8e28097fd785bd635dfbdf6/results.bin} +0 -0
  2. package/android/build/.transforms/078d1206f8e28097fd785bd635dfbdf6/transformed/classes/classes.dex +0 -0
  3. package/android/build/generated/source/buildConfig/debug/com/wix/reactnativeuilib/BuildConfig.java +0 -8
  4. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml +3 -5
  5. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json +16 -0
  6. package/android/build/intermediates/aar_metadata/debug/aar-metadata.properties +2 -0
  7. package/android/build/intermediates/compile_library_classes_jar/debug/classes.jar +0 -0
  8. package/android/build/intermediates/compile_r_class_jar/debug/R.jar +0 -0
  9. package/android/build/intermediates/compile_symbol_list/debug/R.txt +1865 -0
  10. package/android/build/intermediates/compiled_local_resources/debug/out/layout_wheel_picker.xml.flat +0 -0
  11. package/android/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml +1 -1
  12. package/android/build/intermediates/incremental/mergeDebugShaders/merger.xml +1 -1
  13. package/android/build/intermediates/incremental/packageDebugAssets/merger.xml +1 -1
  14. package/android/build/intermediates/incremental/packageDebugResources/compile-file-map.properties +2 -2
  15. package/android/build/intermediates/incremental/packageDebugResources/merger.xml +2 -2
  16. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/BuildConfig.class +0 -0
  17. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/UiLibPackageList.class +0 -0
  18. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlightFrame.class +0 -0
  19. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlightViewTagParams.class +0 -0
  20. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterView.class +0 -0
  21. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager$1.class +0 -0
  22. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.class +0 -0
  23. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/HighlighterViewPackage.class +0 -0
  24. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/ReactHacks.class +0 -0
  25. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.class +0 -0
  26. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/highlighterview/UiUtils.class +0 -0
  27. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/AppContextHolder$1.class +0 -0
  28. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/AppContextHolder.class +0 -0
  29. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$1.class +0 -0
  30. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$2.class +0 -0
  31. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$3.class +0 -0
  32. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$4.class +0 -0
  33. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout$5.class +0 -0
  34. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout.class +0 -0
  35. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootView.class +0 -0
  36. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewManager.class +0 -0
  37. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootViewShadow.class +0 -0
  38. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/KeyboardInputModule.class +0 -0
  39. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/KeyboardInputPackage.class +0 -0
  40. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactContextHolder.class +0 -0
  41. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor$1.class +0 -0
  42. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor$Listener.class +0 -0
  43. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactScreenMonitor.class +0 -0
  44. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$1.class +0 -0
  45. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$2.class +0 -0
  46. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor$Listener.class +0 -0
  47. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/ReactSoftKeyboardMonitor.class +0 -0
  48. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/PredicateFunc.class +0 -0
  49. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils$1.class +0 -0
  50. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils$2.class +0 -0
  51. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.class +0 -0
  52. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils$1.class +0 -0
  53. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils$VisibleViewClassMatchPredicate.class +0 -0
  54. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/keyboardinput/utils/ViewUtils.class +0 -0
  55. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/DefaultKeyListener.class +0 -0
  56. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/KeyListenerProxy.class +0 -0
  57. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule$1.class +0 -0
  58. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.class +0 -0
  59. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.class +0 -0
  60. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/textinput/ViewUtils.class +0 -0
  61. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/utils/LogForwarder$LogType.class +0 -0
  62. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/utils/LogForwarder.class +0 -0
  63. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPicker$1.class +0 -0
  64. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPicker.class +0 -0
  65. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPickerManager.class +0 -0
  66. package/android/build/intermediates/javac/debug/classes/com/wix/reactnativeuilib/wheelpicker/WheelPickerPackage.class +0 -0
  67. package/android/build/intermediates/local_only_symbol_list/debug/{parseDebugLibraryResources/R-def.txt → R-def.txt} +0 -0
  68. package/android/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt +9 -11
  69. package/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml +9 -0
  70. package/android/build/intermediates/navigation_json/debug/navigation.json +1 -0
  71. package/android/build/intermediates/packaged_manifests/debug/output-metadata.json +16 -0
  72. package/android/build/intermediates/runtime_library_classes_jar/debug/classes.jar +0 -0
  73. package/android/build/intermediates/{res/symbol-table-with-package → symbol_list_with_package_name}/debug/package-aware-r.txt +66 -8
  74. package/android/build/outputs/logs/manifest-merger-debug-report.txt +18 -30
  75. package/android/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt +83 -0
  76. package/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardLayout.java +41 -17
  77. package/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/CustomKeyboardRootView.java +12 -0
  78. package/components/{HighlighterOverlayView.js → HighlighterOverlayView.tsx} +40 -46
  79. package/components/Keyboard/KeyboardInput/{CustomKeyboardView.android.js → CustomKeyboardView/CustomKeyboardView.android.tsx} +9 -14
  80. package/components/Keyboard/KeyboardInput/{CustomKeyboardView.ios.js → CustomKeyboardView/CustomKeyboardView.ios.tsx} +20 -21
  81. package/components/Keyboard/KeyboardInput/CustomKeyboardView/index.tsx +16 -0
  82. package/components/Keyboard/KeyboardInput/{CustomKeyboardViewBase.js → CustomKeyboardViewBase.tsx} +26 -20
  83. package/components/Keyboard/KeyboardInput/KeyboardAccessoryView.tsx +226 -0
  84. package/components/Keyboard/KeyboardInput/{KeyboardRegistry.js → KeyboardRegistry.ts} +12 -11
  85. package/components/Keyboard/KeyboardInput/{TextInputKeyboardManager.android.js → TextInputKeyboardManager/TextInputKeyboardManager.android.ts} +0 -0
  86. package/components/Keyboard/KeyboardInput/{TextInputKeyboardManager.ios.js → TextInputKeyboardManager/TextInputKeyboardManager.ios.ts} +5 -4
  87. package/components/Keyboard/KeyboardInput/TextInputKeyboardManager/index.ts +9 -0
  88. package/components/Keyboard/KeyboardInput/keyboardAccessoryView.api.json +57 -0
  89. package/components/Keyboard/KeyboardInput/keyboardRegistry.api.json +50 -0
  90. package/components/Keyboard/KeyboardInput/utils/{EventEmitterManager.js → EventEmitterManager.ts} +5 -4
  91. package/components/Keyboard/KeyboardInput/utils/{KeyboardUtils.js → KeyboardUtils.ts} +0 -0
  92. package/components/Keyboard/KeyboardTracking/{KeyboardAwareInsetsView.js → KeyboardAwareInsetsView.tsx} +3 -4
  93. package/components/Keyboard/KeyboardTracking/{KeyboardTrackingView.android.js → KeyboardTrackingView/KeyboardTrackingView.android.tsx} +1 -0
  94. package/components/Keyboard/KeyboardTracking/{KeyboardTrackingView.ios.js → KeyboardTrackingView/KeyboardTrackingView.ios.tsx} +8 -14
  95. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.tsx +96 -0
  96. package/components/Keyboard/KeyboardTracking/KeyboardTrackingView/keyboardTrackingView.api.json +95 -0
  97. package/components/Keyboard/KeyboardTracking/keyboardAwareInsetsView.api.json +14 -0
  98. package/components/Keyboard/index.ts +15 -0
  99. package/components/SafeArea/{SafeAreaInsetsManager.js → SafeAreaInsetsManager.ts} +10 -7
  100. package/components/SafeArea/SafeAreaSpacerView.tsx +19 -0
  101. package/components/WheelPicker/WheelPickerItem.tsx +21 -0
  102. package/components/WheelPicker/{index.js → index.tsx} +58 -38
  103. package/components/index.ts +16 -0
  104. package/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +40 -3
  105. package/ios/reactnativeuilib.xcodeproj/project.xcworkspace/xcuserdata/inbalti.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  106. package/ios/reactnativeuilib.xcodeproj/xcuserdata/{michaelle.xcuserdatad → inbalti.xcuserdatad}/xcschemes/xcschememanagement.plist +0 -5
  107. package/package.json +1 -1
  108. package/android/.gradle/5.6.1/fileChanges/last-build.bin +0 -0
  109. package/android/.gradle/5.6.1/fileHashes/fileHashes.lock +0 -0
  110. package/android/.gradle/5.6.1/gc.properties +0 -0
  111. package/android/.gradle/vcs-1/gc.properties +0 -0
  112. package/android/.idea/codeStyles/Project.xml +0 -116
  113. package/android/.idea/encodings.xml +0 -4
  114. package/android/.idea/gradle.xml +0 -12
  115. package/android/.idea/misc.xml +0 -9
  116. package/android/.idea/modules.xml +0 -8
  117. package/android/.idea/runConfigurations.xml +0 -12
  118. package/android/.idea/vcs.xml +0 -6
  119. package/android/.idea/workspace.xml +0 -547
  120. package/android/android.iml +0 -18
  121. package/android/build/.transforms/6a4a003a5436f1cfa6c642f89a88b8f1/classes/classes.dex +0 -0
  122. package/android/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output.json +0 -1
  123. package/android/build/intermediates/compile_library_classes/debug/classes.jar +0 -0
  124. package/android/build/intermediates/compile_only_not_namespaced_r_class_jar/debug/R.jar +0 -0
  125. package/android/build/intermediates/incremental/debug-mergeNativeLibs/merge-state +0 -0
  126. package/android/build/intermediates/library_java_res/debug/res.jar +0 -0
  127. package/android/build/intermediates/library_manifest/debug/AndroidManifest.xml +0 -11
  128. package/android/build/intermediates/merged_manifests/debug/output.json +0 -1
  129. package/android/build/intermediates/runtime_library_classes/debug/classes.jar +0 -0
  130. package/android/build/intermediates/symbols/debug/R.txt +0 -1801
  131. package/android/local.properties +0 -8
  132. package/android/react-native-ui-lib.iml +0 -144
  133. package/components/Keyboard/KeyboardInput/KeyboardAccessoryView.js +0 -287
  134. package/components/Keyboard/index.js +0 -7
  135. package/components/SafeArea/SafeAreaSpacerView.js +0 -16
  136. package/components/WheelPicker/WheelPickerItem.js +0 -21
  137. package/components/index.js +0 -17
  138. package/ios/reactnativeuilib.xcodeproj/project.xcworkspace/xcuserdata/michaelle.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
@@ -1,5 +1,6 @@
1
1
  package com.wix.reactnativeuilib.keyboardinput;
2
2
 
3
+ import android.app.Activity;
3
4
  import android.content.Context;
4
5
  import android.view.View;
5
6
  import android.view.Window;
@@ -24,6 +25,8 @@ public class CustomKeyboardLayout implements ReactSoftKeyboardMonitor.Listener,
24
25
  private final InputMethodManager mInputMethodManager;
25
26
  private final ReactSoftKeyboardMonitor mKeyboardMonitor;
26
27
  private WeakReference<CustomKeyboardRootViewShadow> mShadowNode = new WeakReference<>(null);
28
+ private int mSoftInputMode;
29
+ private boolean mIsShown = false;
27
30
 
28
31
  public CustomKeyboardLayout(ReactContext reactContext, ReactSoftKeyboardMonitor keyboardMonitor, ReactScreenMonitor screenMonitor) {
29
32
  mKeyboardMonitor = keyboardMonitor;
@@ -33,6 +36,18 @@ public class CustomKeyboardLayout implements ReactSoftKeyboardMonitor.Listener,
33
36
  screenMonitor.addListener(this);
34
37
  }
35
38
 
39
+ public void setShown(boolean isShown) {
40
+ mIsShown = isShown;
41
+ Window window = getWindow();
42
+ if (window != null) {
43
+ if (mIsShown) {
44
+ mSoftInputMode = window.getAttributes().softInputMode;
45
+ } else {
46
+ window.setSoftInputMode(mSoftInputMode);
47
+ }
48
+ }
49
+ }
50
+
36
51
  @Override
37
52
  public void onSoftKeyboardVisible(boolean distinct) {
38
53
  if (distinct) {
@@ -75,14 +90,17 @@ public class CustomKeyboardLayout implements ReactSoftKeyboardMonitor.Listener,
75
90
  runOnUIThread(new Runnable() {
76
91
  @Override
77
92
  public void run() {
78
- final View focusedView = getCurrentActivity().getCurrentFocus();
79
- if (focusedView instanceof EditText) {
80
- showSoftKeyboard();
81
- } else {
82
- hideCustomKeyboardContent();
83
- clearKeyboardOverlayMode();
93
+ Activity currentActivity = getCurrentActivity();
94
+ if (currentActivity != null) {
95
+ final View focusedView = currentActivity.getCurrentFocus();
96
+ if (focusedView instanceof EditText) {
97
+ showSoftKeyboard();
98
+ } else {
99
+ hideCustomKeyboardContent();
100
+ clearKeyboardOverlayMode();
101
+ }
102
+ promise.resolve(null);
84
103
  }
85
- promise.resolve(null);
86
104
  }
87
105
  });
88
106
  }
@@ -91,9 +109,12 @@ public class CustomKeyboardLayout implements ReactSoftKeyboardMonitor.Listener,
91
109
  runOnUIThread(new Runnable() {
92
110
  @Override
93
111
  public void run() {
94
- final View focusedView = getCurrentActivity().getCurrentFocus();
95
- if (focusedView != null) {
96
- focusedView.clearFocus();
112
+ Activity currentActivity = getCurrentActivity();
113
+ if (currentActivity != null) {
114
+ final View focusedView = currentActivity.getCurrentFocus();
115
+ if (focusedView != null) {
116
+ focusedView.clearFocus();
117
+ }
97
118
  }
98
119
  }
99
120
  });
@@ -167,16 +188,19 @@ public class CustomKeyboardLayout implements ReactSoftKeyboardMonitor.Listener,
167
188
  }
168
189
 
169
190
  private void setKeyboardOverlayMode() {
170
- Window window = getWindow();
171
- if (window != null) {
172
- window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
173
- }
191
+ setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
174
192
  }
175
193
 
176
194
  private void clearKeyboardOverlayMode() {
177
- Window window = getWindow();
178
- if (window != null) {
179
- window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
195
+ setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
196
+ }
197
+
198
+ private void setSoftInputMode(int softInputMode) {
199
+ if (mIsShown) {
200
+ Window window = getWindow();
201
+ if (window != null) {
202
+ window.setSoftInputMode(softInputMode);
203
+ }
180
204
  }
181
205
  }
182
206
 
@@ -24,4 +24,16 @@ public class CustomKeyboardRootView extends FrameLayout {
24
24
  }
25
25
  super.onViewAdded(child);
26
26
  }
27
+
28
+ @Override
29
+ protected void onAttachedToWindow() {
30
+ super.onAttachedToWindow();
31
+ mLayout.setShown(true);
32
+ }
33
+
34
+ @Override
35
+ protected void onDetachedFromWindow() {
36
+ mLayout.setShown(false);
37
+ super.onDetachedFromWindow();
38
+ }
27
39
  }
@@ -1,11 +1,41 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import {requireNativeComponent, processColor, Platform, StyleSheet, Modal} from 'react-native';
2
+ import {requireNativeComponent, processColor, Platform, StyleSheet, Modal, ViewStyle} from 'react-native';
4
3
 
5
- const NativeHighlighterView = requireNativeComponent('HighlighterView', null);
4
+ const NativeHighlighterView = requireNativeComponent('HighlighterView');
6
5
  const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
7
6
 
8
- const HighlighterOverlayView = (props) => {
7
+ type HighlightFrameType = {
8
+ x: number;
9
+ y: number;
10
+ width: number;
11
+ height: number;
12
+ }
13
+
14
+ type HighlightViewTagParams = {
15
+ padding: number | ViewStyle['padding'];
16
+ offset: Pick<HighlightFrameType, 'x' | 'y'>;
17
+ }
18
+
19
+ export type HighlighterOverlayViewProps = {
20
+ visible: boolean;
21
+ overlayColor?: string;
22
+ borderRadius?: number;
23
+ strokeColor?: string;
24
+ strokeWidth?: number;
25
+ onRequestClose?: () => void;
26
+ highlightFrame?: HighlightFrameType;
27
+ style?: ViewStyle;
28
+ highlightViewTag?: number | null;
29
+ children?: JSX.Element[] | JSX.Element;
30
+ highlightViewTagParams?: HighlightViewTagParams;
31
+ minimumRectSize?: Pick<HighlightFrameType, 'width' | 'height'>;
32
+ innerPadding?: number;
33
+ accessible?: boolean;
34
+ testID?: string;
35
+ };
36
+
37
+
38
+ const HighlighterOverlayView = (props: HighlighterOverlayViewProps) => {
9
39
  const {
10
40
  overlayColor,
11
41
  borderRadius,
@@ -19,13 +49,15 @@ const HighlighterOverlayView = (props) => {
19
49
  highlightViewTag,
20
50
  highlightViewTagParams,
21
51
  minimumRectSize,
22
- innerPadding,
52
+ innerPadding
23
53
  } = props;
24
54
 
25
55
  let overlayColorToUse = overlayColor || DefaultOverlayColor;
26
56
  let strokeColorToUse = strokeColor;
27
57
  if (Platform.OS === 'android') {
58
+ // @ts-ignore
28
59
  overlayColorToUse = processColor(overlayColorToUse);
60
+ // @ts-ignore
29
61
  strokeColorToUse = processColor(strokeColorToUse);
30
62
  }
31
63
 
@@ -34,9 +66,10 @@ const HighlighterOverlayView = (props) => {
34
66
  visible={!!(visible)}
35
67
  animationType={'fade'}
36
68
  transparent
37
- onRequestClose={() => onRequestClose && onRequestClose()}
69
+ onRequestClose={() => onRequestClose?.()}
38
70
  >
39
71
  <NativeHighlighterView
72
+ // @ts-ignore, this became private, not sure if I should remove it
40
73
  highlightFrame={highlightFrame}
41
74
  style={[style, {...StyleSheet.absoluteFillObject, backgroundColor: 'transparent'}]}
42
75
  overlayColor={overlayColorToUse}
@@ -53,44 +86,5 @@ const HighlighterOverlayView = (props) => {
53
86
  );
54
87
  };
55
88
 
56
- HighlighterOverlayView.propTypes = {
57
- overlayColor: PropTypes.string,
58
- borderRadius: PropTypes.number,
59
- strokeColor: PropTypes.string,
60
- strokeWidth: PropTypes.number,
61
- visible: PropTypes.bool.isRequired,
62
- onRequestClose: PropTypes.func,
63
- highlightFrame: PropTypes.shape({
64
- x: PropTypes.number,
65
- y: PropTypes.number,
66
- width: PropTypes.number,
67
- height: PropTypes.number,
68
- }),
69
- style: PropTypes.oneOfType([PropTypes.object, PropTypes.number, PropTypes.array]),
70
- highlightViewTag: PropTypes.number,
71
- children: PropTypes.oneOfType([
72
- PropTypes.arrayOf(PropTypes.node),
73
- PropTypes.node,
74
- ]),
75
- highlightViewTagParams: PropTypes.shape({
76
- padding: PropTypes.oneOfType([
77
- PropTypes.number,
78
- PropTypes.shape({
79
- top: PropTypes.number,
80
- left: PropTypes.number,
81
- bottom: PropTypes.number,
82
- right: PropTypes.number}),
83
- ]),
84
- offset: PropTypes.shape({
85
- x: PropTypes.number,
86
- y: PropTypes.number,
87
- }),
88
- }),
89
- minimumRectSize: PropTypes.shape({
90
- width: PropTypes.number,
91
- height: PropTypes.number,
92
- }),
93
- innerPadding: PropTypes.number,
94
- };
95
-
89
+ HighlighterOverlayView.displayName = 'IGNORE';
96
90
  export default HighlighterOverlayView;
@@ -1,27 +1,22 @@
1
1
  import React from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import {requireNativeComponent} from 'react-native';
4
- import TextInputKeyboardManager from './TextInputKeyboardManager';
5
- import KeyboardRegistry from './KeyboardRegistry';
6
- import CustomKeyboardViewBase from './CustomKeyboardViewBase';
3
+ import TextInputKeyboardManager from '../TextInputKeyboardManager/TextInputKeyboardManager.android';
4
+ import KeyboardRegistry from '../KeyboardRegistry';
5
+ import CustomKeyboardViewBase, {CustomKeyboardViewBaseProps} from '../CustomKeyboardViewBase';
7
6
 
8
7
  const CustomKeyboardViewNativeAndroid = requireNativeComponent('CustomKeyboardViewNativeTemp');
9
8
 
10
- export default class CustomKeyboardView extends CustomKeyboardViewBase {
11
- static propTypes = {
12
- initialProps: PropTypes.object,
13
- component: PropTypes.string,
14
- onItemSelected: PropTypes.func
15
- };
9
+ export default class CustomKeyboardView extends CustomKeyboardViewBase<CustomKeyboardViewBaseProps> {
10
+ static displayName = 'IGNORE';
16
11
 
17
- async UNSAFE_componentWillReceiveProps(nextProps) {
18
- const {component} = nextProps;
12
+ async componentDidUpdate(prevProps: CustomKeyboardViewBaseProps) {
13
+ const {component} = this.props;
19
14
 
20
- if (this.props.component !== component && !component) {
15
+ if (prevProps.component !== component && !component) {
21
16
  await TextInputKeyboardManager.reset();
22
17
  }
23
18
 
24
- await super.UNSAFE_componentWillReceiveProps(nextProps);
19
+ super.componentDidUpdate(prevProps);
25
20
  }
26
21
 
27
22
  render() {
@@ -1,25 +1,24 @@
1
- import PropTypes from 'prop-types';
2
- import TextInputKeyboardManager from './TextInputKeyboardManager';
3
- import KeyboardRegistry from './KeyboardRegistry';
4
- import CustomKeyboardViewBase from './CustomKeyboardViewBase';
1
+ import TextInputKeyboardManager from './../TextInputKeyboardManager/TextInputKeyboardManager.ios';
2
+ import KeyboardRegistry from './../KeyboardRegistry';
3
+ import CustomKeyboardViewBase, {CustomKeyboardViewBaseProps} from './../CustomKeyboardViewBase';
5
4
 
6
- export default class CustomKeyboardView extends CustomKeyboardViewBase {
7
- static propTypes = {
8
- /**
9
- * The reference to the actual text input (or the keyboard may not reset when instructed to, etc.)
10
- */
11
- inputRef: PropTypes.object,
12
- initialProps: PropTypes.object,
13
- component: PropTypes.string,
14
- onItemSelected: PropTypes.func,
15
- useSafeArea: PropTypes.bool
16
- };
5
+ export type CustomKeyboardViewProps = CustomKeyboardViewBaseProps & {
6
+ /**
7
+ * The reference to the actual text input (or the keyboard may not reset when instructed to, etc.)
8
+ */
9
+ inputRef?: any;
10
+ useSafeArea?: boolean;
11
+ };
12
+
13
+ export default class CustomKeyboardView extends CustomKeyboardViewBase<CustomKeyboardViewProps> {
14
+ static displayName = 'IGNORE';
17
15
 
18
16
  static defaultProps = {
17
+ initialProps: {},
19
18
  useSafeArea: true
20
19
  };
21
20
 
22
- constructor(props) {
21
+ constructor(props: CustomKeyboardViewProps) {
23
22
  super(props);
24
23
 
25
24
  const {component} = props;
@@ -27,7 +26,7 @@ export default class CustomKeyboardView extends CustomKeyboardViewBase {
27
26
  this.registeredRequestShowKeyboard = false;
28
27
  }
29
28
 
30
- KeyboardRegistry.addListener('onToggleExpandedKeyboard', args => {
29
+ KeyboardRegistry.addListener('onToggleExpandedKeyboard', (args: any) => {
31
30
  const {inputRef, initialProps} = this.props;
32
31
  if (inputRef) {
33
32
  if (this.keyboardExpandedToggle[args.keyboardId] === undefined) {
@@ -46,9 +45,9 @@ export default class CustomKeyboardView extends CustomKeyboardViewBase {
46
45
  super.componentWillUnmount();
47
46
  }
48
47
 
49
- async UNSAFE_componentWillReceiveProps(nextProps) {
50
- const {inputRef: nextInputRef, component: nextComponent, initialProps: nextInitialProps, useSafeArea} = nextProps;
51
- const {component} = this.props;
48
+ componentDidUpdate(prevProps: CustomKeyboardViewProps) {
49
+ const {inputRef: nextInputRef, component: nextComponent, initialProps: nextInitialProps, useSafeArea} = this.props;
50
+ const {component} = prevProps;
52
51
 
53
52
  if (nextInputRef && nextComponent !== component) {
54
53
  if (nextComponent) {
@@ -62,7 +61,7 @@ export default class CustomKeyboardView extends CustomKeyboardViewBase {
62
61
  }
63
62
  }
64
63
 
65
- await super.UNSAFE_componentWillReceiveProps(nextProps);
64
+ super.componentDidUpdate(prevProps);
66
65
  }
67
66
 
68
67
  render() {
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import {Platform} from 'react-native';
3
+ import {default as CustomKeyboardViewIOS, CustomKeyboardViewProps} from './CustomKeyboardView.ios';
4
+ import {default as CustomKeyboardViewAndroid} from './CustomKeyboardView.android';
5
+
6
+ const IsAndroid = Platform.OS === 'android';
7
+
8
+ const CustomKeyboardView = (props: CustomKeyboardViewProps) => {
9
+ const Container = IsAndroid ? CustomKeyboardViewAndroid : CustomKeyboardViewIOS;
10
+
11
+ return (
12
+ <Container {...props}/>
13
+ );
14
+ };
15
+
16
+ export default CustomKeyboardView;
@@ -1,32 +1,37 @@
1
- import {Component} from 'react';
2
- import PropTypes from 'prop-types';
1
+ import React, {Component} from 'react';
3
2
  import KeyboardRegistry from './KeyboardRegistry';
3
+ import {EventSubscription} from 'react-native';
4
4
 
5
- export default class CustomKeyboardViewBase extends Component {
6
- static propTypes = {
7
- initialProps: PropTypes.object,
8
- component: PropTypes.string,
9
- onItemSelected: PropTypes.func
10
- };
5
+ export type CustomKeyboardViewBaseProps = {
6
+ inputRef?: any;
7
+ initialProps?: any;
8
+ component?: string;
9
+ onItemSelected?: (component?: string, args?: any) => void;
10
+ onRequestShowKeyboard?: (keyboardId: string) => void;
11
+ children?: React.ReactChild | React.ReactChild[];
12
+ };
11
13
 
14
+ export default class CustomKeyboardViewBase<T extends CustomKeyboardViewBaseProps> extends Component<T> {
12
15
  static defaultProps = {
13
16
  initialProps: {}
14
17
  };
15
18
 
16
- constructor(props) {
19
+ registeredRequestShowKeyboard = false;
20
+ keyboardExpandedToggle: any;
21
+ keyboardEventListeners: EventSubscription[] = [];
22
+
23
+ constructor(props: T) {
17
24
  super(props);
18
25
 
19
26
  const {component, onItemSelected} = props;
20
27
  if (component) {
21
28
  this.addOnItemSelectListener(onItemSelected, component);
22
-
23
- this.registeredRequestShowKeyboard = false;
24
29
  }
25
30
 
26
31
  this.keyboardExpandedToggle = {};
27
32
  }
28
33
 
29
- shouldComponentUpdate(nextProps) {
34
+ shouldComponentUpdate(nextProps: T) {
30
35
  return nextProps.component !== this.props.component;
31
36
  }
32
37
 
@@ -35,7 +40,7 @@ export default class CustomKeyboardViewBase extends Component {
35
40
  KeyboardRegistry.removeListeners('onRequestShowKeyboard');
36
41
 
37
42
  if (this.keyboardEventListeners) {
38
- this.keyboardEventListeners.forEach(eventListener => eventListener.remove());
43
+ this.keyboardEventListeners.forEach((eventListener: EventSubscription) => eventListener.remove());
39
44
  }
40
45
 
41
46
  if (component) {
@@ -43,28 +48,29 @@ export default class CustomKeyboardViewBase extends Component {
43
48
  }
44
49
  }
45
50
 
46
- addOnItemSelectListener(onItemSelected, component) {
51
+ addOnItemSelectListener(onItemSelected: CustomKeyboardViewBaseProps['onItemSelected'],
52
+ component: CustomKeyboardViewBaseProps['component']) {
47
53
  if (onItemSelected) {
48
- KeyboardRegistry.addListener(`${component}.onItemSelected`, args => {
54
+ KeyboardRegistry.addListener(`${component}.onItemSelected`, (args: any) => {
49
55
  onItemSelected(component, args);
50
56
  });
51
57
  }
52
58
  }
53
59
 
54
- async UNSAFE_componentWillReceiveProps(nextProps) {
55
- const {onRequestShowKeyboard} = nextProps;
60
+ componentDidUpdate(prevProps: T) {
61
+ const {onRequestShowKeyboard} = this.props;
56
62
 
57
63
  if (onRequestShowKeyboard && !this.registeredRequestShowKeyboard) {
58
64
  this.registeredRequestShowKeyboard = true;
59
- KeyboardRegistry.addListener('onRequestShowKeyboard', args => {
65
+ KeyboardRegistry.addListener('onRequestShowKeyboard', (args: any) => {
60
66
  onRequestShowKeyboard(args.keyboardId);
61
67
  });
62
68
  }
63
69
 
64
- this.registerListener(this.props, nextProps);
70
+ this.registerListener(prevProps, this.props);
65
71
  }
66
72
 
67
- registerListener(props, nextProps) {
73
+ registerListener(props: T, nextProps: T) {
68
74
  const {component, onItemSelected} = nextProps;
69
75
  if (component && props.component !== component) {
70
76
  if (props.component) {
@@ -0,0 +1,226 @@
1
+ import React, {Component} from 'react';
2
+ import {
3
+ StyleSheet,
4
+ Platform,
5
+ NativeModules,
6
+ NativeEventEmitter,
7
+ DeviceEventEmitter,
8
+ processColor,
9
+ BackHandler,
10
+ LayoutChangeEvent
11
+ } from 'react-native';
12
+ import KeyboardTrackingView, {KeyboardTrackingViewProps} from '../KeyboardTracking/KeyboardTrackingView';
13
+ import CustomKeyboardView from './CustomKeyboardView';
14
+ import KeyboardUtils from './utils/KeyboardUtils';
15
+
16
+ const IsIOS = Platform.OS === 'ios';
17
+ const IsAndroid = Platform.OS === 'android';
18
+
19
+ type kbTrackingViewProps = Pick<KeyboardTrackingViewProps, 'scrollBehavior' | 'revealKeyboardInteractive' | 'manageScrollView' | 'requiresSameParentToManageScrollView' | 'allowHitsOutsideBounds' | 'addBottomView' | 'bottomViewColor' | 'useSafeArea' | 'usesBottomTabs'>;
20
+
21
+ export type KeyboardAccessoryViewProps = kbTrackingViewProps & {
22
+ /**
23
+ * Content to be rendered above the keyboard
24
+ */
25
+ renderContent?: () => React.ReactElement;
26
+ /**
27
+ * iOS only.
28
+ * The reference to the actual text input (or the keyboard may not reset when instructed to, etc.).
29
+ * This is required.
30
+ */
31
+ kbInputRef?: any;
32
+ /**
33
+ * The keyboard ID (the componentID sent to KeyboardRegistry)
34
+ */
35
+ kbComponent?: string;
36
+ /**
37
+ * The props that will be sent to the KeyboardComponent
38
+ */
39
+ kbInitialProps?: any;
40
+ /**
41
+ * A callback for when the height is changed
42
+ */
43
+ onHeightChanged?: (height: number) => void;
44
+ /**
45
+ * Callback that will be called when an item on the keyboard has been pressed.
46
+ */
47
+ onItemSelected?: (component?: string, args?: any) => void;
48
+ /**
49
+ * Callback that will be called if KeyboardRegistry.requestShowKeyboard is called.
50
+ */
51
+ onRequestShowKeyboard?: () => void;
52
+ /**
53
+ * Callback that will be called once the keyboard has been closed
54
+ */
55
+ onKeyboardResigned?: () => void;
56
+ /**
57
+ * @deprecated
58
+ * Please use 'scrollBehavior' prop instead
59
+ * The scrolling behavior (use KeyboardAccessoryView.scrollBehaviors.NONE | SCROLL_TO_BOTTOM_INVERTED_ONLY | FIXED_OFFSET)
60
+ */
61
+ iOSScrollBehavior?: number;
62
+ children?: React.ReactChild;
63
+ };
64
+
65
+ /**
66
+ * @description: View that allows replacing the default keyboard with other components
67
+ * @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardAccessory/KeyboardAccessoryViewScreen.js
68
+ * @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/KeyboardAccessoryView/KeyboardAccessoryView.gif?raw=true
69
+ */
70
+ class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps> {
71
+ /**
72
+ * @deprecated Please use KeyboardAccessoryView.scrollBehaviors instead
73
+ */
74
+ static iosScrollBehaviors = KeyboardTrackingView.scrollBehaviors; //TODO: remove on V7
75
+ static scrollBehaviors = KeyboardTrackingView.scrollBehaviors;
76
+
77
+ static defaultProps = {
78
+ revealKeyboardInteractive: false,
79
+ manageScrollView: true,
80
+ requiresSameParentToManageScrollView: false,
81
+ addBottomView: false,
82
+ allowHitsOutsideBounds: false,
83
+ scrollBehavior: KeyboardTrackingView.scrollBehaviors.FIXED_OFFSET
84
+ };
85
+
86
+ // TODO: fix
87
+ customInputControllerEventsSubscriber: any;
88
+ trackingViewRef: any;
89
+
90
+ constructor(props: KeyboardAccessoryViewProps) {
91
+ super(props);
92
+
93
+ this.onContainerComponentHeightChanged = this.onContainerComponentHeightChanged.bind(this);
94
+ this.processInitialProps = this.processInitialProps.bind(this);
95
+ this.registerForKeyboardResignedEvent = this.registerForKeyboardResignedEvent.bind(this);
96
+ this.registerAndroidBackHandler = this.registerAndroidBackHandler.bind(this);
97
+ this.onAndroidBackPressed = this.onAndroidBackPressed.bind(this);
98
+
99
+ this.registerForKeyboardResignedEvent();
100
+ this.registerAndroidBackHandler();
101
+ }
102
+
103
+ componentWillUnmount() {
104
+ if (this.customInputControllerEventsSubscriber) {
105
+ this.customInputControllerEventsSubscriber.remove();
106
+ }
107
+ if (IsAndroid) {
108
+ BackHandler.removeEventListener('hardwareBackPress', this.onAndroidBackPressed);
109
+ }
110
+ }
111
+
112
+ onContainerComponentHeightChanged(event: LayoutChangeEvent) {
113
+ const {onHeightChanged} = this.props;
114
+
115
+ if (onHeightChanged) {
116
+ onHeightChanged(event.nativeEvent.layout.height);
117
+ }
118
+ }
119
+
120
+ onAndroidBackPressed() {
121
+ const {kbComponent} = this.props;
122
+
123
+ if (kbComponent) {
124
+ KeyboardUtils.dismiss();
125
+ return true;
126
+ }
127
+ return false;
128
+ }
129
+
130
+ async getNativeProps() {
131
+ if (this.trackingViewRef) {
132
+ return await this.trackingViewRef.getNativeProps();
133
+ }
134
+ return {};
135
+ }
136
+
137
+ registerForKeyboardResignedEvent() {
138
+ const {onKeyboardResigned} = this.props;
139
+ let eventEmitter = null;
140
+ if (IsIOS) {
141
+ if (NativeModules.CustomInputControllerTemp) {
142
+ eventEmitter = new NativeEventEmitter(NativeModules.CustomInputControllerTemp);
143
+ }
144
+ } else {
145
+ eventEmitter = DeviceEventEmitter;
146
+ }
147
+
148
+ if (eventEmitter !== null) {
149
+ this.customInputControllerEventsSubscriber = eventEmitter.addListener('kbdResigned', () => {
150
+ if (onKeyboardResigned) {
151
+ onKeyboardResigned();
152
+ }
153
+ });
154
+ }
155
+ }
156
+
157
+ registerAndroidBackHandler() {
158
+ if (IsAndroid) {
159
+ BackHandler.addEventListener('hardwareBackPress', this.onAndroidBackPressed);
160
+ }
161
+ }
162
+
163
+ processInitialProps() {
164
+ const {kbInitialProps} = this.props;
165
+
166
+ if (IsIOS && kbInitialProps && kbInitialProps.backgroundColor) {
167
+ const processedProps = Object.assign({}, kbInitialProps);
168
+ processedProps.backgroundColor = processColor(processedProps.backgroundColor);
169
+ return processedProps;
170
+ }
171
+
172
+ return kbInitialProps;
173
+ }
174
+
175
+ scrollToStart() {
176
+ if (this.trackingViewRef) {
177
+ this.trackingViewRef.scrollToStart();
178
+ }
179
+ }
180
+
181
+ render() {
182
+ const {
183
+ renderContent,
184
+ kbInputRef,
185
+ kbComponent,
186
+ onItemSelected,
187
+ onRequestShowKeyboard,
188
+ scrollBehavior,
189
+ iOSScrollBehavior,
190
+ ...others
191
+ } = this.props;
192
+
193
+ return (
194
+ <KeyboardTrackingView
195
+ {...others}
196
+ scrollBehavior={IsIOS ? iOSScrollBehavior || scrollBehavior : undefined}
197
+ ref={(r: any) => (this.trackingViewRef = r)}
198
+ style={styles.trackingToolbarContainer}
199
+ onLayout={this.onContainerComponentHeightChanged}
200
+ >
201
+ <>{renderContent?.()}</>
202
+ <CustomKeyboardView
203
+ inputRef={kbInputRef}
204
+ component={kbComponent}
205
+ initialProps={this.processInitialProps()}
206
+ onItemSelected={onItemSelected}
207
+ onRequestShowKeyboard={onRequestShowKeyboard}
208
+ useSafeArea={others.useSafeArea}
209
+ />
210
+ </KeyboardTrackingView>
211
+ );
212
+ }
213
+ }
214
+
215
+ const styles = StyleSheet.create({
216
+ trackingToolbarContainer: {
217
+ ...Platform.select({
218
+ ios: {
219
+ ...StyleSheet.absoluteFillObject,
220
+ top: undefined
221
+ }
222
+ })
223
+ }
224
+ });
225
+
226
+ export default KeyboardAccessoryView;