react-native-ui-lib 7.43.0-snapshot.7073 → 7.43.0-snapshot.7087

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 (114) hide show
  1. package/index.js +1 -0
  2. package/lib/android/build.gradle +5 -5
  3. package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +0 -2
  4. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +31 -23
  5. package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +1 -1
  6. package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.d.ts +4 -1
  7. package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +32 -9
  8. package/lib/components/Keyboard/KeyboardInput/CustomKeyboardViewBase.d.ts +3 -0
  9. package/lib/components/Keyboard/KeyboardInput/KeyboardAccessoryView.d.ts +10 -0
  10. package/lib/components/Keyboard/KeyboardInput/KeyboardAccessoryView.js +30 -4
  11. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +19 -4
  12. package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.js +80 -6
  13. package/lib/components/Keyboard/KeyboardTracking/KeyboardTrackingView/index.d.ts +2 -2
  14. package/lib/components/Keyboard/index.d.ts +1 -1
  15. package/lib/react-native.config.js +1 -3
  16. package/metro.config.js +2 -2
  17. package/package.json +22 -22
  18. package/panView.d.ts +2 -0
  19. package/panView.js +1 -0
  20. package/react-native.config.js +1 -3
  21. package/src/components/actionSheet/index.d.ts +2 -12
  22. package/src/components/actionSheet/index.js +3 -42
  23. package/src/components/badge/index.d.ts +107 -47
  24. package/src/components/button/button.api.json +1 -1
  25. package/src/components/button/index.d.ts +53 -23
  26. package/src/components/button/types.d.ts +0 -1
  27. package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
  28. package/src/components/colorPicker/ColorPickerDialog.js +1 -1
  29. package/src/components/dateTimePicker/index.d.ts +186 -5
  30. package/src/components/dateTimePicker/index.js +1 -2
  31. package/src/components/dialog/dialog.api.json +31 -37
  32. package/src/{incubator → components}/dialog/dialogHeader.api.json +2 -2
  33. package/src/components/dialog/index.d.ts +13 -105
  34. package/src/components/dialog/index.js +204 -212
  35. package/src/{incubator → components}/dialog/types.d.ts +0 -19
  36. package/src/{incubator → components}/dialog/types.js +1 -3
  37. package/src/{incubator → components}/dialog/useDialogContent.d.ts +1 -1
  38. package/src/components/drawer/Swipeable.js +1 -2
  39. package/src/components/drawer/index.js +31 -25
  40. package/src/components/fadedScrollView/index.js +7 -2
  41. package/src/components/index.js +0 -19
  42. package/src/{incubator → components}/panView/index.d.ts +3 -3
  43. package/src/{incubator → components}/panView/index.js +4 -4
  44. package/src/{incubator → components}/panView/usePanGesture.d.ts +1 -1
  45. package/src/components/picker/Picker.driver.new.js +1 -1
  46. package/src/components/picker/helpers/useFieldType.d.ts +53 -23
  47. package/src/components/picker/index.js +1 -1
  48. package/src/components/slider/GradientSlider.d.ts +1 -1
  49. package/src/components/sortableGridList/SortableItem.js +13 -4
  50. package/src/components/sortableList/SortableListItem.js +13 -4
  51. package/src/components/stackAggregator/index.js +16 -11
  52. package/src/components/textField/Input.js +0 -1
  53. package/src/components/textField/presets/outline.d.ts +106 -46
  54. package/src/components/textField/presets/underline.d.ts +106 -46
  55. package/src/components/textField/usePreset.d.ts +72 -44
  56. package/src/{incubator/hooks/useHiddenLocation.web.d.ts → hooks/useHiddenLocation/index.d.ts} +1 -1
  57. package/src/{incubator/hooks/useHiddenLocation.d.ts → hooks/useHiddenLocation/index.web.d.ts} +1 -1
  58. package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
  59. package/src/incubator/expandableOverlay/index.d.ts +42 -3
  60. package/src/incubator/expandableOverlay/index.js +1 -4
  61. package/src/incubator/index.d.ts +0 -2
  62. package/src/incubator/index.js +0 -2
  63. package/src/incubator/toast/index.js +1 -1
  64. package/src/index.d.ts +3 -10
  65. package/src/index.js +41 -160
  66. package/src/testkit/index.d.ts +1 -1
  67. package/src/testkit/index.js +1 -1
  68. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReactHacks.java +0 -30
  69. package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java +0 -34
  70. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java +0 -33
  71. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/KeyListenerProxy.java +0 -53
  72. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.java +0 -54
  73. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.java +0 -28
  74. package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/ViewUtils.java +0 -36
  75. package/panningViews.d.ts +0 -2
  76. package/panningViews.js +0 -1
  77. package/sharedTransition.d.ts +0 -2
  78. package/sharedTransition.js +0 -1
  79. package/src/components/dialog/DialogDismissibleView.d.ts +0 -34
  80. package/src/components/dialog/DialogDismissibleView.js +0 -184
  81. package/src/components/dialog/OverlayFadingBackground.d.ts +0 -14
  82. package/src/components/dialog/OverlayFadingBackground.js +0 -45
  83. package/src/components/panningViews/asPanViewConsumer.d.ts +0 -3
  84. package/src/components/panningViews/asPanViewConsumer.js +0 -16
  85. package/src/components/panningViews/panDismissibleView.d.ts +0 -51
  86. package/src/components/panningViews/panDismissibleView.js +0 -350
  87. package/src/components/panningViews/panGestureView.d.ts +0 -23
  88. package/src/components/panningViews/panGestureView.js +0 -156
  89. package/src/components/panningViews/panListenerView.d.ts +0 -66
  90. package/src/components/panningViews/panListenerView.js +0 -155
  91. package/src/components/panningViews/panResponderView.d.ts +0 -19
  92. package/src/components/panningViews/panResponderView.js +0 -79
  93. package/src/components/panningViews/panningContext.d.ts +0 -3
  94. package/src/components/panningViews/panningContext.js +0 -4
  95. package/src/components/panningViews/panningProvider.d.ts +0 -73
  96. package/src/components/panningViews/panningProvider.js +0 -101
  97. package/src/components/sharedTransition/ShareTransitionContext.js +0 -3
  98. package/src/components/sharedTransition/SharedArea.js +0 -153
  99. package/src/components/sharedTransition/SourceElement.js +0 -44
  100. package/src/components/sharedTransition/TargetElement.js +0 -38
  101. package/src/components/sharedTransition/index.js +0 -9
  102. package/src/incubator/dialog/dialog.api.json +0 -54
  103. package/src/incubator/dialog/index.d.ts +0 -15
  104. package/src/incubator/dialog/index.js +0 -218
  105. /package/src/{incubator → components}/dialog/Dialog.driver.new.d.ts +0 -0
  106. /package/src/{incubator → components}/dialog/Dialog.driver.new.js +0 -0
  107. /package/src/{incubator → components}/dialog/DialogHeader.d.ts +0 -0
  108. /package/src/{incubator → components}/dialog/DialogHeader.js +0 -0
  109. /package/src/{incubator → components}/dialog/useDialogContent.js +0 -0
  110. /package/src/{incubator → components}/panView/panningUtil.d.ts +0 -0
  111. /package/src/{incubator → components}/panView/panningUtil.js +0 -0
  112. /package/src/{incubator → components}/panView/usePanGesture.js +0 -0
  113. /package/src/{incubator/hooks/useHiddenLocation.js → hooks/useHiddenLocation/index.js} +0 -0
  114. /package/src/{incubator/hooks/useHiddenLocation.web.js → hooks/useHiddenLocation/index.web.js} +0 -0
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import 'setimmediate';
1
2
  require('./demo/src/index');
2
3
  require('./demo/src/demoApp'); // this is separated from demo/src/index by purpose
3
4
 
@@ -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 : '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'
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'
9
9
  }
10
10
 
11
11
  android {
@@ -6,7 +6,6 @@ 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;
10
9
 
11
10
  import java.util.Arrays;
12
11
  import java.util.List;
@@ -23,7 +22,6 @@ public class UiLibPackageList {
23
22
  return Arrays.asList(
24
23
  new DynamicFontPackage(),
25
24
  new HighlighterViewPackage(),
26
- new TextInputDelKeyHandlerPackage(),
27
25
  new KeyboardInputPackage(application)
28
26
  );
29
27
  }
@@ -8,12 +8,15 @@ 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;
11
12
  import com.facebook.react.uimanager.IllegalViewOperationException;
12
13
  import com.facebook.react.uimanager.NativeViewHierarchyManager;
13
14
  import com.facebook.react.uimanager.SimpleViewManager;
14
15
  import com.facebook.react.uimanager.ThemedReactContext;
16
+ import com.facebook.react.uimanager.UIManagerHelper;
15
17
  import com.facebook.react.uimanager.UIManagerModule;
16
18
  import com.facebook.react.uimanager.annotations.ReactProp;
19
+ import com.facebook.react.uimanager.common.UIManagerType;
17
20
 
18
21
  import javax.annotation.Nullable;
19
22
 
@@ -75,33 +78,38 @@ class HighlighterViewManager extends SimpleViewManager<HighlighterView> {
75
78
 
76
79
  @ReactProp(name = "highlightViewTag")
77
80
  public void setHighlightViewTag(final HighlighterView view, Integer highlightViewTag) {
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
- }
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);
96
101
  }
97
- });
102
+ } else {
103
+ Log.e("HighlighterView", "was not able to resolve highlightViewTag: " + highlightViewTag.toString());
104
+ }
98
105
  } else {
99
- setViewBasedHighlightFrame(view, resolvedView);
106
+ Log.e("HighlighterView", "was not able to resolve get uiManager for highlightViewTag: " + highlightViewTag.toString());
100
107
  }
108
+ } catch (IllegalViewOperationException e) {
109
+ Log.e("HighlighterView", "invalid highlightViewTag: " + highlightViewTag.toString() + " " + e.toString());
101
110
  }
102
- }
103
- catch (IllegalViewOperationException e) {
104
- Log.e("HighlighterView", "invalid highlightViewTag: " + highlightViewTag.toString() + " " + e.toString());
111
+ } else {
112
+ Log.e("HighlighterView", "highlightViewTag is null");
105
113
  }
106
114
  }
107
115
 
@@ -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
 
@@ -3,5 +3,8 @@ import CustomKeyboardViewBase, { CustomKeyboardViewBaseProps } from '../CustomKe
3
3
  export default class CustomKeyboardView extends CustomKeyboardViewBase<CustomKeyboardViewBaseProps> {
4
4
  static displayName: string;
5
5
  componentDidUpdate(prevProps: CustomKeyboardViewBaseProps): Promise<void>;
6
- render(): React.JSX.Element;
6
+ getStyle: () => {
7
+ height: number | undefined;
8
+ };
9
+ render(): React.JSX.Element | null;
7
10
  }
@@ -1,28 +1,51 @@
1
1
  import React from 'react';
2
- import { requireNativeComponent } from 'react-native';
3
- import TextInputKeyboardManager from "../TextInputKeyboardManager/TextInputKeyboardManager.android";
2
+ import { Keyboard, View } from 'react-native';
4
3
  import KeyboardRegistry from "../KeyboardRegistry";
5
4
  import CustomKeyboardViewBase from "../CustomKeyboardViewBase";
6
- const CustomKeyboardViewNativeAndroid = requireNativeComponent('CustomKeyboardViewNativeTemp');
7
5
  export default class CustomKeyboardView extends CustomKeyboardViewBase {
8
6
  static displayName = 'IGNORE';
9
7
  async componentDidUpdate(prevProps) {
10
8
  const {
11
- component
9
+ component,
10
+ inputRef,
11
+ shouldFocus,
12
+ onKeyboardDismiss
12
13
  } = this.props;
13
- if (prevProps.component !== component && !component) {
14
- await TextInputKeyboardManager.reset();
14
+ if (prevProps.component !== component) {
15
+ if (!component) {
16
+ if (shouldFocus) {
17
+ if (inputRef?.current) {
18
+ inputRef.current.focus?.();
19
+ } else {
20
+ inputRef?.focus?.();
21
+ }
22
+ }
23
+ } else {
24
+ Keyboard.dismiss();
25
+ }
26
+ onKeyboardDismiss?.();
15
27
  }
16
28
  super.componentDidUpdate(prevProps);
17
29
  }
30
+ getStyle = () => {
31
+ const {
32
+ keyboardHeight
33
+ } = this.props;
34
+ return {
35
+ height: keyboardHeight
36
+ };
37
+ };
18
38
  render() {
19
39
  const {
20
40
  component,
21
41
  initialProps
22
42
  } = this.props;
23
43
  const KeyboardComponent = component && KeyboardRegistry.getKeyboard(component);
24
- return <CustomKeyboardViewNativeAndroid>
25
- {KeyboardComponent && <KeyboardComponent {...initialProps} />}
26
- </CustomKeyboardViewNativeAndroid>;
44
+ if (!KeyboardComponent) {
45
+ return null;
46
+ }
47
+ return <View style={this.getStyle()}>
48
+ <KeyboardComponent {...initialProps} />
49
+ </View>;
27
50
  }
28
51
  }
@@ -3,6 +3,9 @@ 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;
6
9
  component?: string;
7
10
  onItemSelected?: (component?: string, args?: any) => void;
8
11
  onRequestShowKeyboard?: (keyboardId: string) => void;
@@ -58,9 +58,16 @@ declare class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps
58
58
  allowHitsOutsideBounds: boolean;
59
59
  scrollBehavior: any;
60
60
  };
61
+ static currentId: number;
61
62
  customInputControllerEventsSubscriber: any;
62
63
  trackingViewRef: any;
64
+ subscription: any;
65
+ id: number;
63
66
  constructor(props: KeyboardAccessoryViewProps);
67
+ state: {
68
+ keyboardHeight: number;
69
+ shouldFocus: boolean;
70
+ };
64
71
  componentWillUnmount(): void;
65
72
  onContainerComponentHeightChanged(event: LayoutChangeEvent): void;
66
73
  onAndroidBackPressed(): boolean;
@@ -69,6 +76,9 @@ declare class KeyboardAccessoryView extends Component<KeyboardAccessoryViewProps
69
76
  registerAndroidBackHandler(): void;
70
77
  processInitialProps(): any;
71
78
  scrollToStart(): void;
79
+ onKeyboardHeightChange: (keyboardHeight: number) => void;
80
+ onDismiss: () => void;
81
+ onKeyboardDismiss: () => void;
72
82
  render(): React.JSX.Element;
73
83
  }
74
84
  export default KeyboardAccessoryView;
@@ -2,7 +2,7 @@ import React, { Component } from 'react';
2
2
  import { StyleSheet, Platform, NativeModules, NativeEventEmitter, DeviceEventEmitter, processColor, BackHandler } from 'react-native';
3
3
  import KeyboardTrackingView from "../KeyboardTracking/KeyboardTrackingView";
4
4
  import CustomKeyboardView from "./CustomKeyboardView";
5
- import KeyboardUtils from "./utils/KeyboardUtils";
5
+ import KeyboardUtils, { KeyboardHeightListener } from "./utils/KeyboardUtils";
6
6
  const IsIOS = Platform.OS === 'ios';
7
7
  const IsAndroid = Platform.OS === 'android';
8
8
  /**
@@ -20,9 +20,11 @@ class KeyboardAccessoryView extends Component {
20
20
  allowHitsOutsideBounds: false,
21
21
  scrollBehavior: KeyboardTrackingView.scrollBehaviors.FIXED_OFFSET
22
22
  };
23
+ static currentId = 0;
23
24
 
24
25
  // TODO: fix
25
26
 
27
+ id = ++KeyboardAccessoryView.currentId;
26
28
  constructor(props) {
27
29
  super(props);
28
30
  this.onContainerComponentHeightChanged = this.onContainerComponentHeightChanged.bind(this);
@@ -33,12 +35,16 @@ class KeyboardAccessoryView extends Component {
33
35
  this.registerForKeyboardResignedEvent();
34
36
  this.registerAndroidBackHandler();
35
37
  }
38
+ state = {
39
+ keyboardHeight: 0,
40
+ shouldFocus: true
41
+ };
36
42
  componentWillUnmount() {
37
43
  if (this.customInputControllerEventsSubscriber) {
38
44
  this.customInputControllerEventsSubscriber.remove();
39
45
  }
40
46
  if (IsAndroid) {
41
- BackHandler.removeEventListener('hardwareBackPress', this.onAndroidBackPressed);
47
+ this.subscription.remove();
42
48
  }
43
49
  }
44
50
  onContainerComponentHeightChanged(event) {
@@ -87,7 +93,7 @@ class KeyboardAccessoryView extends Component {
87
93
  }
88
94
  registerAndroidBackHandler() {
89
95
  if (IsAndroid) {
90
- BackHandler.addEventListener('hardwareBackPress', this.onAndroidBackPressed);
96
+ this.subscription = BackHandler.addEventListener('hardwareBackPress', this.onAndroidBackPressed);
91
97
  }
92
98
  }
93
99
  processInitialProps() {
@@ -106,7 +112,26 @@ class KeyboardAccessoryView extends Component {
106
112
  this.trackingViewRef.scrollToStart();
107
113
  }
108
114
  }
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
+ };
109
130
  render() {
131
+ const {
132
+ keyboardHeight,
133
+ shouldFocus
134
+ } = this.state;
110
135
  const {
111
136
  renderContent,
112
137
  kbInputRef,
@@ -117,8 +142,9 @@ class KeyboardAccessoryView extends Component {
117
142
  ...others
118
143
  } = this.props;
119
144
  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} />
120
146
  <>{renderContent?.()}</>
121
- <CustomKeyboardView inputRef={kbInputRef} component={kbComponent} initialProps={this.processInitialProps()} onItemSelected={onItemSelected} onRequestShowKeyboard={onRequestShowKeyboard} useSafeArea={others.useSafeArea} />
147
+ <CustomKeyboardView keyboardHeight={keyboardHeight} shouldFocus={shouldFocus} onKeyboardDismiss={this.onKeyboardDismiss} inputRef={kbInputRef} component={kbComponent} initialProps={this.processInitialProps()} onItemSelected={onItemSelected} onRequestShowKeyboard={onRequestShowKeyboard} useSafeArea={others.useSafeArea} />
122
148
  </KeyboardTrackingView>;
123
149
  }
124
150
  }
@@ -1,11 +1,26 @@
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
1
  export default class KeyboardUtils {
6
2
  static displayName: string;
3
+ private static listeners;
4
+ private static addListener;
5
+ private static removeListener;
7
6
  /**
8
7
  * Used to dismiss (close) the keyboard.
9
8
  */
10
9
  static dismiss: () => void;
11
10
  }
11
+ interface KeyboardHeightProps {
12
+ id: string;
13
+ onDismiss: () => void;
14
+ }
15
+ declare const useKeyboardHeight: ({ id, onDismiss }: KeyboardHeightProps) => {
16
+ keyboardHeight: number;
17
+ isKeyboardVisible: boolean;
18
+ };
19
+ export interface KeyboardHeightListenerProps {
20
+ id: string;
21
+ onDismiss: () => void;
22
+ onKeyboardHeightChange?: (height: number) => void;
23
+ onKeyboardVisibilityChange?: (isKeyboardVisible: boolean) => void;
24
+ }
25
+ declare const KeyboardHeightListener: ({ id, onDismiss, onKeyboardHeightChange, onKeyboardVisibilityChange }: KeyboardHeightListenerProps) => null;
26
+ export { useKeyboardHeight, KeyboardHeightListener };
@@ -1,17 +1,91 @@
1
- import { Keyboard } from 'react-native';
1
+ import { useCallback, useEffect, useState } from 'react';
2
+ import { Keyboard, Platform } from 'react-native';
2
3
  import TextInputKeyboardManager from "../TextInputKeyboardManager";
4
+ const IS_IOS = Platform.OS === 'ios';
5
+ const DEFAULT_KEYBOARD_HEIGHT = IS_IOS ? 216 : 312; // TODO: verify this value for iOS
3
6
 
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
7
  export default class KeyboardUtils {
9
8
  static displayName = 'KeyboardUtils';
9
+ static listeners = {};
10
+ static addListener = (id, onDismiss) => {
11
+ if (id && onDismiss && !KeyboardUtils.listeners[id]) {
12
+ KeyboardUtils.listeners[id] = onDismiss;
13
+ }
14
+ };
15
+ static removeListener = id => {
16
+ if (id && KeyboardUtils.listeners[id]) {
17
+ delete KeyboardUtils.listeners[id];
18
+ }
19
+ };
20
+
10
21
  /**
11
22
  * Used to dismiss (close) the keyboard.
12
23
  */
13
24
  static dismiss = () => {
14
25
  Keyboard.dismiss();
15
26
  TextInputKeyboardManager.dismissKeyboard();
27
+ Object.keys(KeyboardUtils.listeners).forEach(key => {
28
+ KeyboardUtils.listeners[key]();
29
+ });
30
+ };
31
+ }
32
+ const useKeyboardHeight = ({
33
+ id,
34
+ onDismiss
35
+ }) => {
36
+ const [isInitialized, setIsInitialized] = useState(false);
37
+ const [keyboardHeight, setKeyboardHeight] = useState(DEFAULT_KEYBOARD_HEIGHT);
38
+ const [isVisible, setIsVisible] = useState(false);
39
+ const keyboardDidShow = useCallback(e => {
40
+ if (!isInitialized) {
41
+ setIsInitialized(true);
42
+ setKeyboardHeight(e.endCoordinates.height);
43
+ }
44
+ setIsVisible(true);
45
+ // eslint-disable-next-line react-hooks/exhaustive-deps
46
+ }, []);
47
+ const keyboardDidHide = useCallback(() => {
48
+ setIsVisible(false);
49
+ }, []);
50
+ useEffect(() => {
51
+ const keyboardDidShowListener = Keyboard.addListener('keyboardDidShow', keyboardDidShow);
52
+ const keyboardDidHideListener = Keyboard.addListener('keyboardDidHide', keyboardDidHide);
53
+ // @ts-ignore
54
+ KeyboardUtils.addListener(id, onDismiss);
55
+ return () => {
56
+ keyboardDidShowListener.remove();
57
+ keyboardDidHideListener.remove();
58
+ // @ts-ignore
59
+ KeyboardUtils.removeListener(id);
60
+ };
61
+ // eslint-disable-next-line react-hooks/exhaustive-deps
62
+ }, []);
63
+ return {
64
+ keyboardHeight,
65
+ isKeyboardVisible: isVisible
16
66
  };
17
- }
67
+ };
68
+ const KeyboardHeightListener = ({
69
+ id,
70
+ onDismiss,
71
+ onKeyboardHeightChange,
72
+ onKeyboardVisibilityChange
73
+ }) => {
74
+ const {
75
+ keyboardHeight,
76
+ isKeyboardVisible
77
+ } = useKeyboardHeight({
78
+ id,
79
+ onDismiss
80
+ });
81
+ useEffect(() => {
82
+ onKeyboardHeightChange?.(keyboardHeight);
83
+ // eslint-disable-next-line react-hooks/exhaustive-deps
84
+ }, [keyboardHeight]);
85
+ useEffect(() => {
86
+ onKeyboardVisibilityChange?.(isKeyboardVisible);
87
+ // eslint-disable-next-line react-hooks/exhaustive-deps
88
+ }, [isKeyboardVisible]);
89
+ return null;
90
+ };
91
+ export { useKeyboardHeight, KeyboardHeightListener };
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { ViewStyle, ViewProps } from 'react-native';
2
+ import { StyleProp, 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?: ViewStyle;
75
+ style?: StyleProp<ViewStyle>;
76
76
  children?: React.ReactChild | React.ReactChild[];
77
77
  };
78
78
  declare const _default: React.ForwardRefExoticComponent<Omit<KeyboardTrackingViewProps, "ref"> & React.RefAttributes<unknown>> & {
@@ -26,7 +26,7 @@ declare const _default: {
26
26
  useSafeArea?: boolean | undefined;
27
27
  usesBottomTabs?: boolean | undefined;
28
28
  ref?: any;
29
- style?: import("react-native/types").ViewStyle | undefined;
29
+ style?: import("react-native/types").StyleProp<import("react-native/types").ViewStyle>;
30
30
  children?: import("react").ReactChild | import("react").ReactChild[] | undefined;
31
31
  } & {
32
32
  offset?: number | undefined;
@@ -10,11 +10,9 @@ module.exports = {
10
10
  sourceDir: './android/',
11
11
  packageImportPath: `import com.wix.reactnativeuilib.dynamicfont.DynamicFontPackage;
12
12
  import com.wix.reactnativeuilib.highlighterview.HighlighterViewPackage;
13
- import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;
14
- import com.wix.reactnativeuilib.textinput.TextInputDelKeyHandlerPackage;`,
13
+ import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;`,
15
14
  packageInstance: `new DynamicFontPackage(),
16
15
  new HighlighterViewPackage(),
17
- new TextInputDelKeyHandlerPackage(),
18
16
  new KeyboardInputPackage(getApplication())`
19
17
  }
20
18
  }
package/metro.config.js CHANGED
@@ -5,9 +5,9 @@ const {assetExts, sourceExts} = defaultConfig.resolver;
5
5
 
6
6
  /**
7
7
  * Metro configuration
8
- * https://facebook.github.io/metro/docs/configuration
8
+ * https://reactnative.dev/docs/metro
9
9
  *
10
- * @type {import('metro-config').MetroConfig}
10
+ * @type {import('@react-native/metro-config').MetroConfig}
11
11
  */
12
12
 
13
13
  const config = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-ui-lib",
3
- "version": "7.43.0-snapshot.7073",
3
+ "version": "7.43.0-snapshot.7087",
4
4
  "main": "src/index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "author": "Ethan Sharabi <ethan.shar@gmail.com>",
@@ -62,9 +62,9 @@
62
62
  },
63
63
  "devDependencies": {
64
64
  "@babel/cli": "^7.16.8",
65
- "@babel/core": "^7.24.4",
65
+ "@babel/core": "^7.25.2",
66
66
  "@babel/plugin-transform-modules-commonjs": "^7.17.9",
67
- "@babel/preset-env": "^7.20.0",
67
+ "@babel/preset-env": "^7.25.3",
68
68
  "@babel/preset-react": "^7.10.1",
69
69
  "@babel/runtime": "^7.20.0",
70
70
  "@formatjs/intl-datetimeformat": "^6.0.3",
@@ -73,28 +73,29 @@
73
73
  "@formatjs/intl-numberformat": "^8.0.4",
74
74
  "@formatjs/intl-pluralrules": "^5.0.3",
75
75
  "@react-native-community/blur": "4.4.1",
76
+ "@react-native-community/cli": "15.0.1",
77
+ "@react-native-community/cli-platform-android": "15.0.1",
78
+ "@react-native-community/cli-platform-ios": "15.0.1",
76
79
  "@react-native-community/datetimepicker": "^3.4.6",
77
- "@react-native-community/netinfo": "^5.6.2",
78
- "@react-native/babel-preset": "0.73.21",
79
- "@react-native/eslint-config": "0.73.2",
80
- "@react-native/metro-config": "0.73.5",
81
- "@react-native/typescript-config": "0.73.1",
80
+ "@react-native-community/netinfo": "11.3.3",
81
+ "@react-native/babel-preset": "0.77.2",
82
+ "@react-native/eslint-config": "0.77.2",
83
+ "@react-native/metro-config": "0.77.2",
84
+ "@react-native/typescript-config": "0.77.2",
82
85
  "@shopify/flash-list": "1.7.6",
83
86
  "@testing-library/react-hooks": "^8.0.1",
84
87
  "@testing-library/react-native": "^11.5.1",
85
88
  "@types/hoist-non-react-statics": "^3.3.1",
86
- "@types/jest": "^29.2.1",
89
+ "@types/jest": "^29.5.13",
87
90
  "@types/lodash": "^4.0.0",
88
91
  "@types/prop-types": "^15.5.3",
89
92
  "@types/react": "18.3.7",
90
- "@types/react-native": "0.73.0",
91
93
  "@types/react-test-renderer": "^18.3.0",
92
94
  "@types/tinycolor2": "^1.4.2",
93
95
  "@types/url-parse": "^1.4.3",
94
96
  "@typescript-eslint/eslint-plugin": "^5.3.1",
95
97
  "@typescript-eslint/parser": "^5.3.1",
96
98
  "@welldone-software/why-did-you-render": "^3.2.1",
97
- "babel-jest": "^29.6.3",
98
99
  "babel-plugin-lodash": "^3.3.4",
99
100
  "babel-plugin-module-resolver": "^5.0.0",
100
101
  "eslint": "8.19.0",
@@ -104,7 +105,6 @@
104
105
  "eslint-plugin-react-native": "^4.0.0",
105
106
  "jest": "^29.6.3",
106
107
  "light-date": "^1.2.0",
107
- "metro-react-native-babel-preset": "0.73.10",
108
108
  "moment": "^2.24.0",
109
109
  "object-hash": "^3.0.0",
110
110
  "postcss": "^8.4.21",
@@ -114,27 +114,28 @@
114
114
  "react": "18.2.0",
115
115
  "react-autobind": "^1.0.6",
116
116
  "react-dom": "^18.2.0",
117
- "react-native": "0.73.9",
117
+ "react-native": "0.77.2",
118
118
  "react-native-fs": "^2.20.0",
119
- "react-native-gesture-handler": "2.14.1",
119
+ "react-native-gesture-handler": "2.22.1",
120
120
  "react-native-haptic-feedback": "^1.11.0",
121
121
  "react-native-linear-gradient": "2.6.2",
122
- "react-native-mmkv": "2.11.0",
123
- "react-native-navigation": "7.40.1",
122
+ "react-native-mmkv": "3.2.0",
123
+ "react-native-navigation": "8.1.0-rc01-snapshot.1710",
124
124
  "react-native-reanimated": "3.16.7",
125
125
  "react-native-shimmer-placeholder": "^2.0.6",
126
- "react-native-svg": "15.2.0",
126
+ "react-native-svg": "15.11.2",
127
127
  "react-native-svg-transformer": "1.5.0",
128
- "react-test-renderer": "18.2.0",
128
+ "react-test-renderer": "18.3.1",
129
129
  "reassure": "^0.4.1",
130
+ "setimmediate": "^1.0.5",
130
131
  "shell-utils": "^1.0.10",
131
132
  "typescript": "5.0.4"
132
133
  },
133
134
  "peerDependencies": {
134
135
  "react": ">=17.0.1",
135
- "react-native": ">=0.64.1",
136
- "react-native-gesture-handler": ">=2.5.0",
137
- "react-native-reanimated": ">=2.0.0",
136
+ "react-native": ">=0.76.0",
137
+ "react-native-gesture-handler": ">=2.22.0",
138
+ "react-native-reanimated": ">=3.16.7",
138
139
  "react-native-ui-lib": "*"
139
140
  },
140
141
  "jest": {
@@ -162,7 +163,6 @@
162
163
  "engines": {
163
164
  "node": ">=18"
164
165
  },
165
- "packageManager": "yarn@3.4.1",
166
166
  "files": [
167
167
  "*.js",
168
168
  "*.d.ts",
package/panView.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import {PanView} from './src';
2
+ export default PanView;
package/panView.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./src/components/panView').default;
@@ -10,11 +10,9 @@ module.exports = {
10
10
  sourceDir: '../uilib-native/android/',
11
11
  packageImportPath: `import com.wix.reactnativeuilib.dynamicfont.DynamicFontPackage;
12
12
  import com.wix.reactnativeuilib.highlighterview.HighlighterViewPackage;
13
- import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;
14
- import com.wix.reactnativeuilib.textinput.TextInputDelKeyHandlerPackage;`,
13
+ import com.wix.reactnativeuilib.keyboardinput.KeyboardInputPackage;`,
15
14
  packageInstance: `new DynamicFontPackage(),
16
15
  new HighlighterViewPackage(),
17
- new TextInputDelKeyHandlerPackage(),
18
16
  new KeyboardInputPackage(getApplication())`
19
17
  }
20
18
  }