react-native-ui-lib 7.45.0-snapshot.7266 → 7.46.0

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 (201) 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.driver.new.d.ts +1 -0
  66. package/src/components/button/Button.driver.new.js +4 -0
  67. package/src/components/button/button.api.json +1 -1
  68. package/src/components/button/index.d.ts +23 -53
  69. package/src/components/button/types.d.ts +1 -0
  70. package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
  71. package/src/components/colorPicker/ColorPickerDialog.js +1 -1
  72. package/src/components/dateTimePicker/index.d.ts +5 -186
  73. package/src/components/dateTimePicker/index.js +4 -3
  74. package/src/components/dialog/DialogDismissibleView.d.ts +34 -0
  75. package/src/components/dialog/DialogDismissibleView.js +184 -0
  76. package/src/components/dialog/OverlayFadingBackground.d.ts +14 -0
  77. package/src/components/dialog/OverlayFadingBackground.js +45 -0
  78. package/src/components/dialog/dialog.api.json +37 -31
  79. package/src/components/dialog/index.d.ts +105 -13
  80. package/src/components/dialog/index.js +212 -204
  81. package/src/components/drawer/Swipeable.js +2 -1
  82. package/src/components/drawer/index.js +25 -31
  83. package/src/components/fadedScrollView/index.js +2 -7
  84. package/src/components/featureHighlight/index.d.ts +1 -1
  85. package/src/components/index.js +19 -0
  86. package/src/components/modal/index.d.ts +0 -5
  87. package/src/components/modal/index.js +10 -14
  88. package/src/components/modal/modal.api.json +0 -5
  89. package/src/components/panningViews/asPanViewConsumer.d.ts +3 -0
  90. package/src/components/panningViews/asPanViewConsumer.js +16 -0
  91. package/src/components/panningViews/panDismissibleView.d.ts +51 -0
  92. package/src/components/panningViews/panDismissibleView.js +350 -0
  93. package/src/components/panningViews/panGestureView.d.ts +23 -0
  94. package/src/components/panningViews/panGestureView.js +156 -0
  95. package/src/components/panningViews/panListenerView.d.ts +66 -0
  96. package/src/components/panningViews/panListenerView.js +155 -0
  97. package/src/components/panningViews/panResponderView.d.ts +19 -0
  98. package/src/components/panningViews/panResponderView.js +79 -0
  99. package/src/components/panningViews/panningContext.d.ts +3 -0
  100. package/src/components/panningViews/panningContext.js +4 -0
  101. package/src/components/panningViews/panningProvider.d.ts +73 -0
  102. package/src/components/panningViews/panningProvider.js +101 -0
  103. package/src/components/picker/Picker.driver.new.d.ts +3 -2
  104. package/src/components/picker/Picker.driver.new.js +3 -3
  105. package/src/components/picker/PickerItem.js +20 -6
  106. package/src/components/picker/PickerPresenter.d.ts +1 -0
  107. package/src/components/picker/PickerPresenter.js +23 -1
  108. package/src/components/picker/api/picker.api.json +1 -0
  109. package/src/components/picker/api/pickerItem.api.json +5 -0
  110. package/src/components/picker/helpers/useFieldType.d.ts +23 -53
  111. package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
  112. package/src/components/picker/helpers/usePickerLabel.js +3 -2
  113. package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
  114. package/src/components/picker/helpers/usePickerMigrationWarnings.js +12 -0
  115. package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
  116. package/src/components/picker/helpers/usePickerSearch.js +8 -4
  117. package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
  118. package/src/components/picker/helpers/usePickerSelection.js +10 -2
  119. package/src/components/picker/index.js +22 -4
  120. package/src/components/picker/types.d.ts +24 -1
  121. package/src/components/segmentedControl/index.js +3 -3
  122. package/src/components/sharedTransition/ShareTransitionContext.js +3 -0
  123. package/src/components/sharedTransition/SharedArea.js +153 -0
  124. package/src/components/sharedTransition/SourceElement.js +44 -0
  125. package/src/components/sharedTransition/TargetElement.js +38 -0
  126. package/src/components/sharedTransition/index.js +9 -0
  127. package/src/components/slider/GradientSlider.d.ts +1 -1
  128. package/src/components/sortableGridList/SortableItem.js +4 -13
  129. package/src/components/sortableList/SortableListItem.js +4 -13
  130. package/src/components/stackAggregator/index.js +11 -16
  131. package/src/components/text/Text.driver.new.d.ts +2 -2
  132. package/src/components/text/Text.driver.new.js +2 -2
  133. package/src/components/textField/Input.js +1 -0
  134. package/src/components/textField/TextField.driver.new.d.ts +3 -2
  135. package/src/components/textField/TextField.driver.new.js +2 -2
  136. package/src/components/textField/presets/outline.d.ts +46 -106
  137. package/src/components/textField/presets/underline.d.ts +46 -106
  138. package/src/components/textField/usePreset.d.ts +44 -72
  139. package/src/incubator/dialog/dialog.api.json +54 -0
  140. package/src/{components → incubator}/dialog/dialogHeader.api.json +2 -2
  141. package/src/incubator/dialog/index.d.ts +15 -0
  142. package/src/incubator/dialog/index.js +218 -0
  143. package/src/{components → incubator}/dialog/types.d.ts +19 -0
  144. package/src/{components → incubator}/dialog/types.js +3 -1
  145. package/src/{components → incubator}/dialog/useDialogContent.d.ts +1 -1
  146. package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
  147. package/src/incubator/expandableOverlay/index.d.ts +3 -42
  148. package/src/incubator/expandableOverlay/index.js +4 -1
  149. package/src/{hooks/useHiddenLocation/index.d.ts → incubator/hooks/useHiddenLocation.d.ts} +1 -1
  150. package/src/{hooks/useHiddenLocation/index.web.d.ts → incubator/hooks/useHiddenLocation.web.d.ts} +1 -1
  151. package/src/incubator/index.d.ts +2 -0
  152. package/src/incubator/index.js +2 -0
  153. package/src/{components → incubator}/panView/index.d.ts +3 -3
  154. package/src/{components → incubator}/panView/index.js +4 -4
  155. package/src/{components → incubator}/panView/usePanGesture.d.ts +1 -1
  156. package/src/incubator/toast/Toast.driver.new.d.ts +1 -0
  157. package/src/incubator/toast/index.js +1 -1
  158. package/src/index.d.ts +10 -3
  159. package/src/index.js +160 -41
  160. package/src/testkit/index.d.ts +1 -1
  161. package/src/testkit/index.js +1 -1
  162. package/src/testkit/new/Component.driver.d.ts +1 -4
  163. package/src/testkit/new/Component.driver.js +3 -3
  164. package/lib/components/HighlighterOverlayView/index.js +0 -49
  165. package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +0 -51
  166. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +0 -26
  167. package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +0 -91
  168. package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +0 -274
  169. package/lib/components/SafeArea/index.d.ts +0 -10
  170. package/lib/components/SafeArea/index.js +0 -11
  171. package/panView.d.ts +0 -2
  172. package/panView.js +0 -1
  173. /package/lib/components/{HighlighterOverlayView/index.web.js → HighlighterOverlayView.web.js} +0 -0
  174. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.d.ts +0 -0
  175. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.js +0 -0
  176. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.d.ts +0 -0
  177. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.js +0 -0
  178. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
  179. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
  180. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
  181. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
  182. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.d.ts +0 -0
  183. /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.js +0 -0
  184. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts → KeyboardInput/utils/EventEmitterManager.d.ts} +0 -0
  185. /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js → KeyboardInput/utils/EventEmitterManager.js} +0 -0
  186. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
  187. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
  188. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.js +0 -0
  189. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.d.ts +0 -0
  190. /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.js +0 -0
  191. /package/lib/components/Keyboard/{KeyboardAwareInsetsView → KeyboardTracking}/keyboardAwareInsetsView.api.json +0 -0
  192. /package/src/{components → incubator}/dialog/Dialog.driver.new.d.ts +0 -0
  193. /package/src/{components → incubator}/dialog/Dialog.driver.new.js +0 -0
  194. /package/src/{components → incubator}/dialog/DialogHeader.d.ts +0 -0
  195. /package/src/{components → incubator}/dialog/DialogHeader.js +0 -0
  196. /package/src/{components → incubator}/dialog/useDialogContent.js +0 -0
  197. /package/src/{hooks/useHiddenLocation/index.js → incubator/hooks/useHiddenLocation.js} +0 -0
  198. /package/src/{hooks/useHiddenLocation/index.web.js → incubator/hooks/useHiddenLocation.web.js} +0 -0
  199. /package/src/{components → incubator}/panView/panningUtil.d.ts +0 -0
  200. /package/src/{components → incubator}/panView/panningUtil.js +0 -0
  201. /package/src/{components → incubator}/panView/usePanGesture.js +0 -0
@@ -0,0 +1,218 @@
1
+ import React, { useMemo, useCallback, useImperativeHandle, forwardRef, useEffect, useState } from 'react';
2
+ import { StyleSheet } from 'react-native';
3
+ import hoistStatics from 'hoist-non-react-statics';
4
+ import { Extrapolation, interpolate, runOnJS, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
5
+ import { Gesture, GestureDetector } from 'react-native-gesture-handler';
6
+ import { Spacings, Colors, BorderRadiuses } from "../../style";
7
+ import { useDidUpdate } from "../../hooks";
8
+ import { asBaseComponent, Constants } from "../../commons/new";
9
+ import View from "../../components/view";
10
+ import Modal from "../../components/modal";
11
+ import { extractAlignmentsValues } from "../../commons/modifiers";
12
+ import useHiddenLocation from "../hooks/useHiddenLocation";
13
+ import DialogHeader from "./DialogHeader";
14
+ import useDialogContent from "./useDialogContent";
15
+ import { DialogProps, DialogDirections, DialogDirectionsEnum, DialogHeaderProps, DialogMigrationProps } from "./types";
16
+ export { DialogProps, DialogDirections, DialogDirectionsEnum, DialogHeaderProps, DialogMigrationProps };
17
+ const THRESHOLD_VELOCITY = 750;
18
+ const Dialog = (props, ref) => {
19
+ const {
20
+ visible = false,
21
+ headerProps,
22
+ showCloseButton,
23
+ closeButtonProps,
24
+ containerStyle: propsContainerStyle,
25
+ containerProps: propsContainerProps,
26
+ width,
27
+ height,
28
+ onDismiss,
29
+ direction = DialogDirectionsEnum.DOWN,
30
+ ignoreBackgroundPress,
31
+ modalProps = {},
32
+ useSafeArea,
33
+ testID,
34
+ children
35
+ } = props;
36
+ const {
37
+ overlayBackgroundColor = Colors.rgba(Colors.grey10, 0.65),
38
+ ...otherModalProps
39
+ } = modalProps;
40
+ const visibility = useSharedValue(0); // value between 0 (closed) and 1 (open)
41
+ const initialTranslation = useSharedValue(0);
42
+ const [modalVisibility, setModalVisibility] = useState(visible); // unfortunately this is needed when changing visibility by the user (clicking on an option etc)
43
+
44
+ const {
45
+ setRef,
46
+ onLayout,
47
+ hiddenLocation: _hiddenLocation
48
+ } = useHiddenLocation();
49
+ const hiddenLocation = _hiddenLocation[direction];
50
+ const wasMeasured = _hiddenLocation.wasMeasured;
51
+ const isVertical = useMemo(() => {
52
+ 'worklet';
53
+
54
+ return direction === DialogDirectionsEnum.DOWN || direction === DialogDirectionsEnum.UP;
55
+ }, [direction]);
56
+ const getTranslationInterpolation = useCallback(value => {
57
+ 'worklet';
58
+
59
+ return interpolate(value, [0, 1], [hiddenLocation, 0], Extrapolation.CLAMP);
60
+ }, [hiddenLocation]);
61
+ const getTranslationReverseInterpolation = useCallback(value => {
62
+ 'worklet';
63
+
64
+ return interpolate(value, [hiddenLocation, 0], [0, 1]);
65
+ }, [hiddenLocation]);
66
+ const _onDismiss = useCallback(() => {
67
+ 'worklet';
68
+
69
+ runOnJS(setModalVisibility)(false);
70
+ }, []);
71
+ const close = useCallback(() => {
72
+ 'worklet';
73
+
74
+ visibility.value = withTiming(0, undefined, _onDismiss);
75
+ // eslint-disable-next-line react-hooks/exhaustive-deps
76
+ }, [_onDismiss]);
77
+ const open = useCallback(() => {
78
+ 'worklet';
79
+
80
+ visibility.value = withSpring(1);
81
+ // eslint-disable-next-line react-hooks/exhaustive-deps
82
+ }, []);
83
+ useEffect(() => {
84
+ if (visible) {
85
+ setModalVisibility(true);
86
+ } else if (wasMeasured && modalVisibility) {
87
+ // Close when sending visible = false
88
+ close();
89
+ }
90
+ // eslint-disable-next-line react-hooks/exhaustive-deps
91
+ }, [visible, wasMeasured]);
92
+ useDidUpdate(() => {
93
+ if (wasMeasured) {
94
+ if (modalVisibility) {
95
+ open();
96
+ } else if (Constants.isAndroid) {
97
+ onDismiss?.();
98
+ }
99
+ }
100
+ // eslint-disable-next-line react-hooks/exhaustive-deps
101
+ }, [modalVisibility, wasMeasured]);
102
+ const alignmentStyle = useMemo(() => {
103
+ return {
104
+ flex: 1,
105
+ alignItems: 'center',
106
+ ...extractAlignmentsValues(props)
107
+ };
108
+ // eslint-disable-next-line react-hooks/exhaustive-deps
109
+ }, []);
110
+ const {
111
+ renderDialogContent,
112
+ containerProps,
113
+ containerStyle
114
+ } = useDialogContent({
115
+ showCloseButton,
116
+ close,
117
+ closeButtonProps,
118
+ containerStyle: propsContainerStyle,
119
+ containerProps: propsContainerProps,
120
+ headerProps,
121
+ children
122
+ });
123
+ const animatedStyle = useAnimatedStyle(() => {
124
+ if (isVertical) {
125
+ return {
126
+ transform: [{
127
+ translateY: getTranslationInterpolation(visibility.value)
128
+ }]
129
+ };
130
+ } else {
131
+ return {
132
+ transform: [{
133
+ translateX: getTranslationInterpolation(visibility.value)
134
+ }]
135
+ };
136
+ }
137
+ });
138
+ const style = useMemo(() => {
139
+ return [styles.defaultDialogStyle, {
140
+ backgroundColor: Colors.$backgroundDefault
141
+ }, containerStyle, animatedStyle, width ? {
142
+ width
143
+ } : undefined, height ? {
144
+ height
145
+ } : undefined];
146
+ // eslint-disable-next-line react-hooks/exhaustive-deps
147
+ }, [containerStyle, width, height]);
148
+ const shouldClose = event => {
149
+ 'worklet';
150
+
151
+ const wasPannedOverThreshold = Math.abs(getTranslationInterpolation(visibility.value)) >= Math.abs(hiddenLocation / 3);
152
+ let velocity;
153
+ switch (direction) {
154
+ case DialogDirectionsEnum.DOWN:
155
+ default:
156
+ velocity = event.velocityY;
157
+ break;
158
+ case DialogDirectionsEnum.UP:
159
+ velocity = -event.velocityY;
160
+ break;
161
+ case DialogDirectionsEnum.LEFT:
162
+ velocity = -event.velocityX;
163
+ break;
164
+ case DialogDirectionsEnum.RIGHT:
165
+ velocity = event.velocityX;
166
+ break;
167
+ }
168
+ const wasFlung = velocity >= THRESHOLD_VELOCITY;
169
+ return wasPannedOverThreshold || wasFlung;
170
+ };
171
+ const panGesture = Gesture.Pan().onStart(event => {
172
+ initialTranslation.value = getTranslationReverseInterpolation(isVertical ? event.translationY : event.translationX) - visibility.value;
173
+ }).onUpdate(event => {
174
+ visibility.value = getTranslationReverseInterpolation(isVertical ? event.translationY : event.translationX) - initialTranslation.value;
175
+ }).onEnd(event => {
176
+ if (shouldClose(event)) {
177
+ close();
178
+ } else {
179
+ open();
180
+ }
181
+ });
182
+ useImperativeHandle(ref, () => ({
183
+ dismiss: close
184
+ }));
185
+ const renderDialog = () => <GestureDetector gesture={panGesture}>
186
+ <View {...containerProps} reanimated={!Constants.accessibility.isReduceMotionEnabled} style={style} onLayout={onLayout} ref={setRef} testID={testID}>
187
+ {renderDialogContent()}
188
+ </View>
189
+ </GestureDetector>;
190
+ const overlayStyle = useAnimatedStyle(() => {
191
+ return {
192
+ opacity: visibility.value,
193
+ backgroundColor: overlayBackgroundColor
194
+ };
195
+ }, [overlayBackgroundColor]);
196
+ const renderOverlayView = () => <View testID={`${testID}.overlayFadingBackground`} absF reanimated style={overlayStyle} pointerEvents="none" />;
197
+ return <Modal transparent animationType={'none'} {...otherModalProps} testID={`${testID}.modal`} useGestureHandlerRootView visible={modalVisibility} onBackgroundPress={ignoreBackgroundPress ? undefined : close} onRequestClose={ignoreBackgroundPress ? undefined : close} onDismiss={onDismiss}>
198
+ {renderOverlayView()}
199
+ <View useSafeArea={useSafeArea} pointerEvents={'box-none'} style={alignmentStyle}>
200
+ {renderDialog()}
201
+ </View>
202
+ </Modal>;
203
+ };
204
+ Dialog.displayName = 'Incubator.Dialog';
205
+ Dialog.directions = DialogDirectionsEnum;
206
+ Dialog.Header = DialogHeader;
207
+ const _Dialog = forwardRef(Dialog);
208
+ hoistStatics(_Dialog, Dialog);
209
+ export default asBaseComponent(_Dialog);
210
+ const styles = StyleSheet.create({
211
+ defaultDialogStyle: {
212
+ marginBottom: Spacings.s5,
213
+ maxHeight: '60%',
214
+ width: 250,
215
+ borderRadius: BorderRadiuses.br20,
216
+ overflow: 'hidden'
217
+ }
218
+ });
@@ -1,6 +1,7 @@
1
1
  import { PropsWithChildren, ReactElement } from 'react';
2
2
  import { type DimensionValue, type StyleProp, type TextStyle, type ViewStyle } from 'react-native';
3
3
  import { AlignmentModifiers } from '../../commons/modifiers';
4
+ import { DialogProps as DialogPropsOld } from '../../components/dialog';
4
5
  import { ButtonProps } from '../../components/button';
5
6
  import { ModalProps } from '../../components/modal';
6
7
  import { PanningDirections, PanningDirectionsEnum } from '../panView';
@@ -129,3 +130,21 @@ export interface _DialogProps extends AlignmentModifiers, Pick<ViewProps, 'useSa
129
130
  testID?: string;
130
131
  }
131
132
  export type DialogProps = PropsWithChildren<_DialogProps>;
133
+ export interface _DialogPropsOld {
134
+ /**
135
+ * The props to pass to the dialog expandable container
136
+ */
137
+ dialogProps?: DialogPropsOld;
138
+ migrateDialog?: false;
139
+ }
140
+ export interface _DialogPropsNew {
141
+ /**
142
+ * The props to pass to the dialog expandable container
143
+ */
144
+ dialogProps?: DialogProps;
145
+ /**
146
+ * Migrate the Dialog to DialogNew (make sure you use only new props in dialogProps)
147
+ */
148
+ migrateDialog: true;
149
+ }
150
+ export type DialogMigrationProps = _DialogPropsOld | _DialogPropsNew;
@@ -1,3 +1,5 @@
1
1
  import { PanningDirectionsEnum } from "../panView";
2
2
  const DialogDirectionsEnum = PanningDirectionsEnum;
3
- export { DialogDirectionsEnum };
3
+ export { DialogDirectionsEnum };
4
+
5
+ // For migration purposes
@@ -5,7 +5,7 @@ interface InternalDialogCloseButtonProps extends PropsWithChildren<DialogCloseBu
5
5
  }
6
6
  declare const useDialogContent: (props: InternalDialogCloseButtonProps) => {
7
7
  renderDialogContent: () => React.JSX.Element;
8
- containerStyle: false | "" | import("react-native").ViewStyle | import("react-native").RegisteredStyle<import("react-native").ViewStyle> | import("react-native").RecursiveArray<import("react-native").ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").ViewStyle>> | (import("react-native").StyleProp<import("react-native").ViewStyle> | {
8
+ containerStyle: false | import("react-native").ViewStyle | import("react-native").RegisteredStyle<import("react-native").ViewStyle> | import("react-native").RecursiveArray<import("react-native").ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").ViewStyle>> | (import("react-native").StyleProp<import("react-native").ViewStyle> | {
9
9
  backgroundColor: string;
10
10
  })[] | null | undefined;
11
11
  containerProps: Omit<import("../../components/view").ViewProps, "style" | "testID" | "ref" | "onLayout" | "animated" | "reanimated"> | undefined;
@@ -1,5 +1,5 @@
1
1
  import { ModalDriver } from "../../components/modal/Modal.driver.new";
2
- import { DialogDriver } from "../../components/dialog/Dialog.driver.new";
2
+ import { DialogDriver } from "../dialog/Dialog.driver.new";
3
3
  import { useComponentDriver } from "../../testkit/new/Component.driver";
4
4
  import { usePressableDriver } from "../../testkit/new/usePressable.driver";
5
5
  export const ExpandableOverlayDriver = (props, useDialog) => {
@@ -1,7 +1,7 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { TouchableOpacityProps } from '../../components/touchableOpacity';
3
3
  import { ModalProps, ModalTopBarProps } from '../../components/modal';
4
- import { DialogProps } from '../../components/dialog';
4
+ import { DialogMigrationProps } from '../dialog';
5
5
  export interface ExpandableOverlayMethods {
6
6
  openExpandable: () => void;
7
7
  closeExpandable: () => void;
@@ -10,7 +10,7 @@ export interface ExpandableOverlayMethods {
10
10
  export interface RenderCustomOverlayProps extends ExpandableOverlayMethods {
11
11
  visible: boolean;
12
12
  }
13
- export type ExpandableOverlayProps = TouchableOpacityProps & PropsWithChildren<{
13
+ export type ExpandableOverlayProps = TouchableOpacityProps & DialogMigrationProps & PropsWithChildren<{
14
14
  /**
15
15
  * The content to render inside the expandable modal/dialog
16
16
  */
@@ -19,10 +19,6 @@ export type ExpandableOverlayProps = TouchableOpacityProps & PropsWithChildren<{
19
19
  * Whether to use a dialog as expandable container (by default the container will be a full screen modal)
20
20
  */
21
21
  useDialog?: boolean;
22
- /**
23
- * The props to pass to the dialog expandable container
24
- */
25
- dialogProps?: DialogProps;
26
22
  /**
27
23
  * The props to pass to the modal expandable container
28
24
  */
@@ -44,40 +40,5 @@ export type ExpandableOverlayProps = TouchableOpacityProps & PropsWithChildren<{
44
40
  */
45
41
  disabled?: boolean;
46
42
  }>;
47
- declare const _default: React.ForwardRefExoticComponent<TouchableOpacityProps & {
48
- /**
49
- * The content to render inside the expandable modal/dialog
50
- */
51
- expandableContent?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
52
- /**
53
- * Whether to use a dialog as expandable container (by default the container will be a full screen modal)
54
- */
55
- useDialog?: boolean | undefined;
56
- /**
57
- * The props to pass to the dialog expandable container
58
- */
59
- dialogProps?: DialogProps | undefined;
60
- /**
61
- * The props to pass to the modal expandable container
62
- */
63
- modalProps?: ModalProps | undefined;
64
- /**
65
- * Whether to render a modal top bar (relevant only for modal)
66
- */
67
- showTopBar?: boolean | undefined;
68
- /**
69
- * The modal top bar props to pass on
70
- */
71
- topBarProps?: ModalTopBarProps | undefined;
72
- /**
73
- * A custom overlay to render instead of Modal or Dialog components
74
- */
75
- renderCustomOverlay?: ((props: RenderCustomOverlayProps) => React.ReactElement<any, string | React.JSXElementConstructor<any>> | null | undefined) | undefined;
76
- /**
77
- * Disabled opening expandable overlay
78
- */
79
- disabled?: boolean | undefined;
80
- } & {
81
- children?: React.ReactNode;
82
- } & React.RefAttributes<ExpandableOverlayMethods>>;
43
+ declare const _default: React.ForwardRefExoticComponent<ExpandableOverlayProps & React.RefAttributes<ExpandableOverlayMethods>>;
83
44
  export default _default;
@@ -3,7 +3,8 @@ import { AccessibilityInfo, findNodeHandle } from 'react-native';
3
3
  import TouchableOpacity from "../../components/touchableOpacity";
4
4
  import View from "../../components/view";
5
5
  import Modal from "../../components/modal";
6
- import Dialog from "../../components/dialog";
6
+ import DialogOld from "../../components/dialog";
7
+ import DialogNew from "../dialog";
7
8
  import { Colors } from "../../style";
8
9
  const ExpandableOverlay = (props, ref) => {
9
10
  const {
@@ -12,6 +13,7 @@ const ExpandableOverlay = (props, ref) => {
12
13
  useDialog,
13
14
  modalProps,
14
15
  dialogProps,
16
+ migrateDialog,
15
17
  showTopBar,
16
18
  topBarProps,
17
19
  renderCustomOverlay,
@@ -51,6 +53,7 @@ const ExpandableOverlay = (props, ref) => {
51
53
  </Modal>;
52
54
  };
53
55
  const renderDialog = () => {
56
+ const Dialog = migrateDialog ? DialogNew : DialogOld;
54
57
  return <Dialog testID={`${testID}.overlay`} {...dialogProps} visible={visible} onDismiss={closeExpandable}>
55
58
  {expandableContent}
56
59
  </Dialog>;
@@ -1,6 +1,6 @@
1
1
  import { RefCallback } from 'react';
2
2
  import { View, LayoutChangeEvent } from 'react-native';
3
- import { PanningDirectionsEnum } from '../../components/panView';
3
+ import { PanningDirectionsEnum } from '../panView';
4
4
  type HiddenLocationRecord = Record<PanningDirectionsEnum, number>;
5
5
  export interface HiddenLocation extends HiddenLocationRecord {
6
6
  wasMeasured: boolean;
@@ -1,6 +1,6 @@
1
1
  import { RefCallback } from 'react';
2
2
  import { View, LayoutChangeEvent } from 'react-native';
3
- import { PanningDirectionsEnum } from '../../components/panView';
3
+ import { PanningDirectionsEnum } from '../panView';
4
4
  type HiddenLocationRecord = Record<PanningDirectionsEnum, number>;
5
5
  export interface HiddenLocation extends HiddenLocationRecord {
6
6
  wasMeasured: boolean;
@@ -3,6 +3,8 @@ export { default as ExpandableOverlay, ExpandableOverlayProps, ExpandableOverlay
3
3
  export { default as TextField, TextFieldProps, FieldContextType, TextFieldMethods, TextFieldRef, TextFieldValidationMessagePosition, TextFieldValidator } from '../components/textField';
4
4
  export { default as Toast, ToastProps, ToastPresets } from './toast';
5
5
  export { default as TouchableOpacity, TouchableOpacityProps } from './TouchableOpacity';
6
+ export { default as PanView, PanViewProps, PanViewDirections, PanViewDismissThreshold } from './panView';
6
7
  export { default as Slider, SliderRef, SliderProps } from './slider';
8
+ export { default as Dialog, DialogProps, DialogHeaderProps, DialogStatics, DialogImperativeMethods } from './dialog';
7
9
  export { default as ChipsInput, ChipsInputProps, ChipsInputChangeReason, ChipsInputChipProps } from '../components/chipsInput';
8
10
  export { default as WheelPicker, WheelPickerProps, WheelPickerItemProps, WheelPickerAlign, WheelPickerItemValue } from '../components/WheelPicker';
@@ -4,7 +4,9 @@ export { default as ExpandableOverlay, ExpandableOverlayProps, ExpandableOverlay
4
4
  export { default as TextField, TextFieldProps, FieldContextType, TextFieldMethods, TextFieldRef, TextFieldValidationMessagePosition, TextFieldValidator } from "../components/textField";
5
5
  export { default as Toast, ToastProps, ToastPresets } from "./toast";
6
6
  export { default as TouchableOpacity, TouchableOpacityProps } from "./TouchableOpacity";
7
+ export { default as PanView, PanViewProps, PanViewDirections, PanViewDismissThreshold } from "./panView";
7
8
  export { default as Slider, SliderRef, SliderProps } from "./slider";
9
+ export { default as Dialog, DialogProps, DialogHeaderProps, DialogStatics, DialogImperativeMethods } from "./dialog";
8
10
  // TODO: delete exports after fully removing from private
9
11
  export { default as ChipsInput, ChipsInputProps, ChipsInputChangeReason, ChipsInputChipProps } from "../components/chipsInput";
10
12
  export { default as WheelPicker, WheelPickerProps, WheelPickerItemProps, WheelPickerAlign, WheelPickerItemValue } from "../components/WheelPicker";
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { StyleProp, ViewStyle } from 'react-native';
3
- import { ViewProps } from '../view';
3
+ import { ViewProps } from '../../components/view';
4
4
  import { PanningDirections, PanningDirectionsEnum } from './panningUtil';
5
- import { PanGestureProps, PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold } from './usePanGesture';
6
- export { PanningDirections, PanningDirectionsEnum, PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold };
5
+ import { PanGestureProps, PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold, DEFAULT_DIRECTIONS, DEFAULT_ANIMATION_CONFIG } from './usePanGesture';
6
+ export { PanningDirections, PanningDirectionsEnum, PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold, DEFAULT_DIRECTIONS, DEFAULT_ANIMATION_CONFIG };
7
7
  export interface PanViewProps extends Omit<PanGestureProps, 'hiddenLocation'>, ViewProps {
8
8
  /**
9
9
  * Add a style to the container
@@ -2,11 +2,11 @@ import React from 'react';
2
2
  import { useAnimatedStyle } from 'react-native-reanimated';
3
3
  import { GestureDetector, gestureHandlerRootHOC } from 'react-native-gesture-handler';
4
4
  import { asBaseComponent } from "../../commons/new";
5
- import View from "../view";
6
- import useHiddenLocation from "../../hooks/useHiddenLocation";
5
+ import View from "../../components/view";
6
+ import useHiddenLocation from "../hooks/useHiddenLocation";
7
7
  import { PanningDirections, PanningDirectionsEnum } from "./panningUtil";
8
- import usePanGesture, { PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold, DEFAULT_DIRECTIONS } from "./usePanGesture";
9
- export { PanningDirections, PanningDirectionsEnum, PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold };
8
+ import usePanGesture, { PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold, DEFAULT_DIRECTIONS, DEFAULT_ANIMATION_CONFIG } from "./usePanGesture";
9
+ export { PanningDirections, PanningDirectionsEnum, PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold, DEFAULT_DIRECTIONS, DEFAULT_ANIMATION_CONFIG };
10
10
  const PanView = props => {
11
11
  const {
12
12
  directions = DEFAULT_DIRECTIONS,
@@ -1,5 +1,5 @@
1
1
  import { PanningDirections, PanningDirectionsEnum, PanningDismissThreshold } from './panningUtil';
2
- import type { HiddenLocation } from '../../hooks/useHiddenLocation';
2
+ import type { HiddenLocation } from '../hooks/useHiddenLocation';
3
3
  export type PanViewDirections = PanningDirections;
4
4
  export declare const PanViewDirectionsEnum: typeof PanningDirectionsEnum;
5
5
  export type PanViewDismissThreshold = PanningDismissThreshold;
@@ -46,6 +46,7 @@ export declare const ToastDriver: (props: ComponentProps) => {
46
46
  getLabelStyle: () => import("react-native/types").TextStyle;
47
47
  getIconStyle: () => any;
48
48
  getIcon: () => import("../../testkit/new/Component.driver").ComponentDriverResult;
49
+ isDisabled: () => boolean;
49
50
  };
50
51
  getElement: () => import("react-test-renderer").ReactTestInstance;
51
52
  queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
@@ -7,7 +7,7 @@ import View from "../../components/view";
7
7
  import Text from "../../components/text";
8
8
  import Icon from "../../components/icon";
9
9
  import Button from "../../components/button";
10
- import PanView from "../../components/panView";
10
+ import PanView from "../panView";
11
11
  import { ToastProps, ToastPresets } from "./types";
12
12
  import useToastTimer from "./helpers/useToastTimer";
13
13
  import useToastPresets from "./helpers/useToastPresets";
package/src/index.d.ts CHANGED
@@ -6,7 +6,7 @@ export * from 'uilib-native';
6
6
  export { asBaseComponent, Config, Constants, forwardRef, withScrollEnabler, WithScrollEnablerProps, withScrollReached, WithScrollReachedProps, UIComponent, BaseComponentInjectedProps, ForwardRefInjectedProps, ContainerModifiers, MarginModifiers, PaddingModifiers, TypographyModifiers, ColorsModifiers, BackgroundColorModifier } from './commons/new';
7
7
  export { BaseComponent, PureBaseComponent } from './commons';
8
8
  import * as Incubator from './incubator';
9
- export { ExpandableOverlayProps, ExpandableOverlayMethods, ToastProps, ToastPresets } from './incubator';
9
+ export { ExpandableOverlayProps, ExpandableOverlayMethods, ToastProps, ToastPresets, PanViewProps, PanViewDirections, PanViewDismissThreshold } from './incubator';
10
10
  import * as Hooks from './hooks';
11
11
  import * as Modifiers from './commons/modifiers';
12
12
  export { default as LogService } from './services/LogService';
@@ -32,7 +32,7 @@ export { default as ColorSwatch, ColorSwatchProps, ColorInfo } from './component
32
32
  export { default as ConnectionStatusBar, ConnectionStatusBarProps } from './components/connectionStatusBar';
33
33
  export { default as Dash, DashProps } from './components/dash';
34
34
  export { default as DateTimePicker, DateTimePickerProps, DateTimePickerMode } from './components/dateTimePicker';
35
- export { default as Dialog, DialogProps, DialogHeaderProps, DialogStatics, DialogImperativeMethods, DialogDirections, DialogDirectionsEnum } from './components/dialog';
35
+ export { default as Dialog, DialogProps, DialogDirections, DialogDirectionsEnum } from './components/dialog';
36
36
  export { default as Drawer, DrawerProps, DrawerItemProps } from './components/drawer';
37
37
  export { default as ExpandableSection, ExpandableSectionProps } from './components/expandableSection';
38
38
  export { default as Fader, FaderProps, FaderPosition } from './components/fader';
@@ -60,8 +60,14 @@ export { default as Modal, ModalProps, ModalTopBarProps } from './components/mod
60
60
  export { default as NumberInput, NumberInputProps, NumberInputData } from './components/numberInput';
61
61
  export { default as Overlay, OverlayTypes } from './components/overlay';
62
62
  export { default as PageControl, PageControlProps } from './components/pageControl';
63
+ export { default as PanDismissibleView, PanDismissibleViewProps, DismissibleAnimationProps } from './components/panningViews/panDismissibleView';
64
+ export { default as PanGestureView, PanGestureViewProps } from './components/panningViews/panGestureView';
65
+ export { default as PanListenerView, PanListenerViewProps } from './components/panningViews/panListenerView';
66
+ export { default as PanningContext } from './components/panningViews/panningContext';
67
+ export { default as PanningProvider, PanningDirections, PanLocationProps, PanAmountsProps, PanDirectionsProps } from './components/panningViews/panningProvider';
68
+ export { default as PanResponderView, PanResponderViewProps } from './components/panningViews/panResponderView';
69
+ export { default as asPanViewConsumer } from './components/panningViews/asPanViewConsumer';
63
70
  export { default as Picker, PickerProps, PickerItemProps, PickerValue, PickerModes, PickerFieldTypes, PickerSearchStyle, RenderCustomModalProps, PickerItemsListProps, PickerMethods, PickerSelectionStatusProps } from './components/picker';
64
- export { default as PanView, PanViewProps, PanningDirections, PanningDirectionsEnum, PanViewDirections, PanViewDirectionsEnum, PanViewDismissThreshold } from './components/panView';
65
71
  export { default as PieChart, type PieChartProps, PieChartSegmentProps } from './components/pieChart';
66
72
  export { default as ProgressBar, ProgressBarProps } from './components/progressBar';
67
73
  export { default as ProgressiveImage, ProgressiveImageProps } from './components/progressiveImage';
@@ -73,6 +79,7 @@ export { default as ScrollBar, ScrollBarProps } from './components/scrollBar';
73
79
  export { default as SearchInput, SearchInputProps, SearchInputRef } from './components/searchInput';
74
80
  export { default as SectionsWheelPicker, SectionsWheelPickerProps } from './components/sectionsWheelPicker';
75
81
  export { default as SegmentedControl, SegmentedControlProps, SegmentedControlItemProps, SegmentedControlPreset } from './components/segmentedControl';
82
+ export { default as SharedTransition } from './components/sharedTransition';
76
83
  export { default as SkeletonView, SkeletonViewProps } from './components/skeletonView';
77
84
  export { default as SortableGridList, SortableGridListProps } from './components/sortableGridList';
78
85
  export { default as SortableList, SortableListProps, SortableListItemProps } from './components/sortableList';