react-native-ui-lib 7.46.2 → 7.46.3-snapshot.7341
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.
- package/babel.config.js +12 -0
- package/index.js +1 -0
- package/lib/android/build.gradle +5 -5
- package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +0 -2
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +31 -23
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +1 -1
- package/lib/components/{HighlighterOverlayView.d.ts → HighlighterOverlayView/index.d.ts} +1 -1
- package/lib/components/HighlighterOverlayView/index.js +49 -0
- package/lib/components/{HighlighterOverlayView.web.d.ts → HighlighterOverlayView/index.web.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.android.d.ts +5 -2
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +51 -0
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.d.ts +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/CustomKeyboardView.ios.js +3 -3
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.d.ts +3 -0
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/CustomKeyboardView}/CustomKeyboardViewBase.js +1 -1
- package/lib/components/Keyboard/{KeyboardInput/utils → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager}/__tests__/EventEmitterManager.spec.js +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/__tests__/KeyboardRegistry.spec.js +1 -1
- package/lib/components/Keyboard/{KeyboardInput/KeyboardRegistry.d.ts → KeyboardAccessoryView/KeyboardRegistry/index.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardInput/KeyboardRegistry.js → KeyboardAccessoryView/KeyboardRegistry/index.js} +1 -1
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView/KeyboardRegistry}/keyboardRegistry.api.json +9 -9
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +26 -0
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +91 -0
- package/lib/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.d.ts → KeyboardAccessoryView/index.d.ts} +11 -1
- package/lib/components/Keyboard/{KeyboardInput/KeyboardAccessoryView.js → KeyboardAccessoryView/index.js} +31 -5
- package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/keyboardAccessoryView.api.json +5 -5
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.d.ts → KeyboardAwareInsetsView/index.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardAwareInsetsView.js → KeyboardAwareInsetsView/index.js} +1 -1
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.d.ts +1 -4
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.ios.js +5 -8
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.d.ts +2 -2
- package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/keyboardTrackingView.api.json +11 -20
- package/lib/components/Keyboard/index.d.ts +6 -6
- package/lib/components/Keyboard/index.js +6 -6
- package/lib/components/SafeArea/SafeAreaInsetsManager.d.ts +21 -7
- package/lib/components/SafeArea/SafeAreaInsetsManager.js +95 -31
- package/lib/components/SafeArea/SafeAreaSpacerView.d.ts +2 -2
- package/lib/components/SafeArea/SafeAreaSpacerView.js +63 -9
- package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +274 -0
- package/lib/components/SafeArea/index.d.ts +10 -0
- package/lib/components/SafeArea/index.js +11 -0
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.m +52 -8
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h +1 -7
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.m +1 -1
- package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +109 -41
- package/lib/package.json +1 -1
- package/lib/react-native.config.js +1 -3
- package/metro.config.js +2 -2
- package/package.json +25 -25
- package/panView.d.ts +2 -0
- package/panView.js +1 -0
- package/react-native.config.js +1 -3
- package/src/commons/Constants.js +2 -5
- package/src/commons/modifiers.d.ts +1 -0
- package/src/commons/modifiers.js +5 -2
- package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +5 -1
- package/src/components/actionSheet/index.d.ts +2 -12
- package/src/components/actionSheet/index.js +3 -42
- package/src/components/badge/index.d.ts +107 -47
- package/src/components/button/button.api.json +6 -1
- package/src/components/button/index.d.ts +61 -23
- package/src/components/button/index.js +18 -1
- package/src/components/button/types.d.ts +4 -1
- package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
- package/src/components/colorPicker/ColorPickerDialog.js +1 -1
- package/src/components/dateTimePicker/index.d.ts +186 -5
- package/src/components/dateTimePicker/index.js +3 -4
- package/src/components/dialog/dialog.api.json +31 -37
- package/src/{incubator → components}/dialog/dialogHeader.api.json +2 -2
- package/src/components/dialog/index.d.ts +13 -105
- package/src/components/dialog/index.js +204 -212
- package/src/{incubator → components}/dialog/types.d.ts +0 -19
- package/src/{incubator → components}/dialog/types.js +1 -3
- package/src/{incubator → components}/dialog/useDialogContent.d.ts +1 -1
- package/src/components/drawer/Swipeable.js +1 -2
- package/src/components/drawer/index.js +31 -25
- package/src/components/fadedScrollView/index.js +7 -2
- package/src/components/featureHighlight/index.d.ts +1 -1
- package/src/components/index.js +0 -19
- package/src/components/marquee/types.js +4 -1
- package/src/components/modal/index.d.ts +5 -0
- package/src/components/modal/index.js +14 -10
- package/src/components/modal/modal.api.json +5 -0
- package/src/{incubator → components}/panView/index.d.ts +3 -3
- package/src/{incubator → components}/panView/index.js +4 -4
- package/src/{incubator → components}/panView/usePanGesture.d.ts +1 -1
- package/src/components/picker/Picker.driver.new.d.ts +2 -2
- package/src/components/picker/Picker.driver.new.js +3 -3
- package/src/components/picker/PickerItem.js +6 -20
- package/src/components/picker/PickerPresenter.d.ts +0 -1
- package/src/components/picker/PickerPresenter.js +1 -23
- package/src/components/picker/api/picker.api.json +0 -1
- package/src/components/picker/api/pickerItem.api.json +0 -5
- package/src/components/picker/helpers/useFieldType.d.ts +53 -23
- package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
- package/src/components/picker/helpers/usePickerLabel.js +2 -3
- package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
- package/src/components/picker/helpers/usePickerMigrationWarnings.js +0 -12
- package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSearch.js +4 -8
- package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSelection.js +2 -10
- package/src/components/picker/index.js +4 -22
- package/src/components/picker/types.d.ts +1 -24
- package/src/components/segmentedControl/index.js +3 -3
- package/src/components/slider/GradientSlider.d.ts +1 -1
- package/src/components/sortableGridList/SortableItem.js +13 -4
- package/src/components/sortableList/SortableListItem.js +13 -4
- package/src/components/stackAggregator/index.js +16 -11
- package/src/components/text/Text.driver.new.d.ts +2 -2
- package/src/components/text/Text.driver.new.js +2 -2
- package/src/components/textField/Input.js +0 -1
- package/src/components/textField/TextField.driver.new.d.ts +2 -2
- package/src/components/textField/TextField.driver.new.js +2 -2
- package/src/components/textField/presets/outline.d.ts +106 -46
- package/src/components/textField/presets/underline.d.ts +106 -46
- package/src/components/textField/types.js +1 -0
- package/src/components/textField/usePreset.d.ts +72 -44
- package/src/components/timeline/types.js +3 -0
- package/src/{incubator/hooks/useHiddenLocation.web.d.ts → hooks/useHiddenLocation/index.d.ts} +1 -1
- package/src/{incubator/hooks/useHiddenLocation.d.ts → hooks/useHiddenLocation/index.web.d.ts} +1 -1
- package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
- package/src/incubator/expandableOverlay/index.d.ts +42 -3
- package/src/incubator/expandableOverlay/index.js +1 -4
- package/src/incubator/gradient/BorderGradient.d.ts +4 -0
- package/src/incubator/gradient/BorderGradient.js +45 -0
- package/src/incubator/gradient/CircleGradient.d.ts +4 -0
- package/src/incubator/gradient/CircleGradient.js +35 -0
- package/src/incubator/gradient/RectangleGradient.d.ts +4 -0
- package/src/incubator/gradient/RectangleGradient.js +32 -0
- package/src/incubator/gradient/index.d.ts +5 -0
- package/src/incubator/gradient/index.js +31 -0
- package/src/incubator/gradient/types.d.ts +26 -0
- package/src/incubator/gradient/types.js +1 -0
- package/src/incubator/gradient/useAngleTransform.d.ts +27 -0
- package/src/incubator/gradient/useAngleTransform.js +72 -0
- package/src/incubator/index.d.ts +1 -2
- package/src/incubator/index.js +2 -3
- package/src/incubator/toast/index.js +1 -1
- package/src/index.d.ts +3 -10
- package/src/index.js +42 -162
- package/src/optionalDependencies/LinearGradientPackage.d.ts +1 -1
- package/src/testkit/index.d.ts +1 -1
- package/src/testkit/index.js +1 -1
- package/src/testkit/new/Component.driver.d.ts +4 -1
- package/src/testkit/new/Component.driver.js +3 -3
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReactHacks.java +0 -30
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java +0 -34
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java +0 -33
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/KeyListenerProxy.java +0 -53
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.java +0 -54
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.java +0 -28
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/ViewUtils.java +0 -36
- package/lib/components/HighlighterOverlayView.js +0 -40
- package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +0 -28
- package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +0 -11
- package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.js +0 -17
- package/panningViews.d.ts +0 -2
- package/panningViews.js +0 -1
- package/sharedTransition.d.ts +0 -2
- package/sharedTransition.js +0 -1
- package/src/components/dialog/DialogDismissibleView.d.ts +0 -34
- package/src/components/dialog/DialogDismissibleView.js +0 -184
- package/src/components/dialog/OverlayFadingBackground.d.ts +0 -14
- package/src/components/dialog/OverlayFadingBackground.js +0 -45
- package/src/components/panningViews/asPanViewConsumer.d.ts +0 -3
- package/src/components/panningViews/asPanViewConsumer.js +0 -16
- package/src/components/panningViews/panDismissibleView.d.ts +0 -51
- package/src/components/panningViews/panDismissibleView.js +0 -350
- package/src/components/panningViews/panGestureView.d.ts +0 -23
- package/src/components/panningViews/panGestureView.js +0 -156
- package/src/components/panningViews/panListenerView.d.ts +0 -66
- package/src/components/panningViews/panListenerView.js +0 -155
- package/src/components/panningViews/panResponderView.d.ts +0 -19
- package/src/components/panningViews/panResponderView.js +0 -79
- package/src/components/panningViews/panningContext.d.ts +0 -3
- package/src/components/panningViews/panningContext.js +0 -4
- package/src/components/panningViews/panningProvider.d.ts +0 -73
- package/src/components/panningViews/panningProvider.js +0 -101
- package/src/components/sharedTransition/ShareTransitionContext.js +0 -3
- package/src/components/sharedTransition/SharedArea.js +0 -153
- package/src/components/sharedTransition/SourceElement.js +0 -44
- package/src/components/sharedTransition/TargetElement.js +0 -38
- package/src/components/sharedTransition/index.js +0 -9
- package/src/incubator/dialog/dialog.api.json +0 -54
- package/src/incubator/dialog/index.d.ts +0 -15
- package/src/incubator/dialog/index.js +0 -218
- /package/lib/components/{HighlighterOverlayView.web.js → HighlighterOverlayView/index.web.js} +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/CustomKeyboardView/index.web.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.d.ts → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts} +0 -0
- /package/lib/components/Keyboard/{KeyboardInput/utils/EventEmitterManager.js → KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js} +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardInput → KeyboardAccessoryView}/TextInputKeyboardManager/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking → KeyboardAwareInsetsView}/keyboardAwareInsetsView.api.json +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardTracking/KeyboardTrackingView → KeyboardTrackingView}/index.web.js +0 -0
- /package/src/{incubator → components}/dialog/Dialog.driver.new.d.ts +0 -0
- /package/src/{incubator → components}/dialog/Dialog.driver.new.js +0 -0
- /package/src/{incubator → components}/dialog/DialogHeader.d.ts +0 -0
- /package/src/{incubator → components}/dialog/DialogHeader.js +0 -0
- /package/src/{incubator → components}/dialog/useDialogContent.js +0 -0
- /package/src/{incubator → components}/panView/panningUtil.d.ts +0 -0
- /package/src/{incubator → components}/panView/panningUtil.js +0 -0
- /package/src/{incubator → components}/panView/usePanGesture.js +0 -0
- /package/src/{incubator/hooks/useHiddenLocation.js → hooks/useHiddenLocation/index.js} +0 -0
- /package/src/{incubator/hooks/useHiddenLocation.web.js → hooks/useHiddenLocation/index.web.js} +0 -0
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { requireNativeComponent, processColor, Platform, StyleSheet, Modal } from 'react-native';
|
|
3
|
-
const NativeHighlighterView = requireNativeComponent('HighlighterView');
|
|
4
|
-
const DefaultOverlayColor = 'rgba(0, 0, 0, 0.5)';
|
|
5
|
-
const HighlighterOverlayView = props => {
|
|
6
|
-
const {
|
|
7
|
-
overlayColor,
|
|
8
|
-
borderRadius,
|
|
9
|
-
strokeColor,
|
|
10
|
-
strokeWidth,
|
|
11
|
-
visible,
|
|
12
|
-
onRequestClose,
|
|
13
|
-
highlightFrame,
|
|
14
|
-
style,
|
|
15
|
-
children,
|
|
16
|
-
highlightViewTag,
|
|
17
|
-
highlightViewTagParams,
|
|
18
|
-
minimumRectSize,
|
|
19
|
-
innerPadding
|
|
20
|
-
} = props;
|
|
21
|
-
let overlayColorToUse = overlayColor || DefaultOverlayColor;
|
|
22
|
-
let strokeColorToUse = strokeColor;
|
|
23
|
-
if (Platform.OS === 'android') {
|
|
24
|
-
// @ts-ignore
|
|
25
|
-
overlayColorToUse = processColor(overlayColorToUse);
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
strokeColorToUse = processColor(strokeColorToUse);
|
|
28
|
-
}
|
|
29
|
-
return <Modal visible={!!visible} animationType={'fade'} transparent onRequestClose={() => onRequestClose?.()}>
|
|
30
|
-
<NativeHighlighterView
|
|
31
|
-
// @ts-ignore, this became private, not sure if I should remove it
|
|
32
|
-
highlightFrame={highlightFrame} style={[style, {
|
|
33
|
-
...StyleSheet.absoluteFillObject,
|
|
34
|
-
backgroundColor: 'transparent'
|
|
35
|
-
}]} overlayColor={overlayColorToUse} borderRadius={borderRadius} strokeColor={strokeColorToUse} strokeWidth={strokeWidth} highlightViewTag={highlightViewTag} highlightViewTagParams={highlightViewTagParams} minimumRectSize={minimumRectSize} innerPadding={innerPadding} />
|
|
36
|
-
{children}
|
|
37
|
-
</Modal>;
|
|
38
|
-
};
|
|
39
|
-
HighlighterOverlayView.displayName = 'IGNORE';
|
|
40
|
-
export default HighlighterOverlayView;
|
package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { requireNativeComponent } from 'react-native';
|
|
3
|
-
import TextInputKeyboardManager from "../TextInputKeyboardManager/TextInputKeyboardManager.android";
|
|
4
|
-
import KeyboardRegistry from "../KeyboardRegistry";
|
|
5
|
-
import CustomKeyboardViewBase from "../CustomKeyboardViewBase";
|
|
6
|
-
const CustomKeyboardViewNativeAndroid = requireNativeComponent('CustomKeyboardViewNativeTemp');
|
|
7
|
-
export default class CustomKeyboardView extends CustomKeyboardViewBase {
|
|
8
|
-
static displayName = 'IGNORE';
|
|
9
|
-
async componentDidUpdate(prevProps) {
|
|
10
|
-
const {
|
|
11
|
-
component
|
|
12
|
-
} = this.props;
|
|
13
|
-
if (prevProps.component !== component && !component) {
|
|
14
|
-
await TextInputKeyboardManager.reset();
|
|
15
|
-
}
|
|
16
|
-
super.componentDidUpdate(prevProps);
|
|
17
|
-
}
|
|
18
|
-
render() {
|
|
19
|
-
const {
|
|
20
|
-
component,
|
|
21
|
-
initialProps
|
|
22
|
-
} = this.props;
|
|
23
|
-
const KeyboardComponent = component && KeyboardRegistry.getKeyboard(component);
|
|
24
|
-
return <CustomKeyboardViewNativeAndroid>
|
|
25
|
-
{KeyboardComponent && <KeyboardComponent {...initialProps} />}
|
|
26
|
-
</CustomKeyboardViewNativeAndroid>;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description: util for managing the keyboard.
|
|
3
|
-
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js
|
|
4
|
-
*/
|
|
5
|
-
export default class KeyboardUtils {
|
|
6
|
-
static displayName: string;
|
|
7
|
-
/**
|
|
8
|
-
* Used to dismiss (close) the keyboard.
|
|
9
|
-
*/
|
|
10
|
-
static dismiss: () => void;
|
|
11
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Keyboard } from 'react-native';
|
|
2
|
-
import TextInputKeyboardManager from "../TextInputKeyboardManager";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @description: util for managing the keyboard.
|
|
6
|
-
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/nativeComponentScreens/keyboardInput/KeyboardInputViewScreen.js
|
|
7
|
-
*/
|
|
8
|
-
export default class KeyboardUtils {
|
|
9
|
-
static displayName = 'KeyboardUtils';
|
|
10
|
-
/**
|
|
11
|
-
* Used to dismiss (close) the keyboard.
|
|
12
|
-
*/
|
|
13
|
-
static dismiss = () => {
|
|
14
|
-
Keyboard.dismiss();
|
|
15
|
-
TextInputKeyboardManager.dismissKeyboard();
|
|
16
|
-
};
|
|
17
|
-
}
|
package/panningViews.d.ts
DELETED
package/panningViews.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./src/components/panningViews').default;
|
package/sharedTransition.d.ts
DELETED
package/sharedTransition.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./src/components/sharedTransition').default;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { PanningDirections } from '../panningViews/panningProvider';
|
|
4
|
-
interface DialogDismissibleProps {
|
|
5
|
-
/**
|
|
6
|
-
* Additional styling
|
|
7
|
-
*/
|
|
8
|
-
style?: StyleProp<ViewStyle>;
|
|
9
|
-
/**
|
|
10
|
-
* The direction of the allowed pan (default is DOWN)
|
|
11
|
-
* Types: UP, DOWN, LEFT and RIGHT (using PanningProvider.Directions.###)
|
|
12
|
-
*/
|
|
13
|
-
direction?: PanningDirections;
|
|
14
|
-
/**
|
|
15
|
-
* onDismiss callback
|
|
16
|
-
*/
|
|
17
|
-
onDismiss?: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* The dialog`s container style
|
|
20
|
-
*/
|
|
21
|
-
containerStyle?: StyleProp<ViewStyle>;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to show the dialog or not
|
|
24
|
-
*/
|
|
25
|
-
visible?: boolean;
|
|
26
|
-
}
|
|
27
|
-
interface Props extends DialogDismissibleProps {
|
|
28
|
-
children?: React.ReactNode | React.ReactNode[];
|
|
29
|
-
}
|
|
30
|
-
declare const DialogDismissibleView: {
|
|
31
|
-
(props: Props): React.JSX.Element;
|
|
32
|
-
displayName: string;
|
|
33
|
-
};
|
|
34
|
-
export default DialogDismissibleView;
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import _isUndefined from "lodash/isUndefined";
|
|
2
|
-
import React, { useEffect, useRef, useCallback, useContext } from 'react';
|
|
3
|
-
import { Animated, Easing, StyleSheet } from 'react-native';
|
|
4
|
-
import { Constants } from "../../commons/new";
|
|
5
|
-
import View from "../view";
|
|
6
|
-
import PanningContext from "../panningViews/panningContext";
|
|
7
|
-
import PanningProvider from "../panningViews/panningProvider";
|
|
8
|
-
import PanResponderView from "../panningViews/panResponderView";
|
|
9
|
-
const MAXIMUM_DRAGS_AFTER_SWIPE = 2;
|
|
10
|
-
|
|
11
|
-
// TODO: move this to panningContext
|
|
12
|
-
|
|
13
|
-
const DEFAULT_DIRECTION = PanningProvider.Directions.DOWN;
|
|
14
|
-
const DialogDismissibleView = props => {
|
|
15
|
-
const {
|
|
16
|
-
direction = DEFAULT_DIRECTION,
|
|
17
|
-
visible: propsVisible,
|
|
18
|
-
containerStyle,
|
|
19
|
-
style,
|
|
20
|
-
children,
|
|
21
|
-
onDismiss = () => {}
|
|
22
|
-
} = props;
|
|
23
|
-
// @ts-expect-error
|
|
24
|
-
const {
|
|
25
|
-
isPanning,
|
|
26
|
-
dragDeltas,
|
|
27
|
-
swipeDirections
|
|
28
|
-
} = useContext(PanningContext);
|
|
29
|
-
const width = useRef(Constants.screenWidth);
|
|
30
|
-
const height = useRef(Constants.screenHeight);
|
|
31
|
-
const TOP_INSET = useRef(Constants.isIphoneX ? Constants.getSafeAreaInsets().top : Constants.isIOS ? 20 : 0);
|
|
32
|
-
const BOTTOM_INSET = useRef(Constants.isIphoneX ? Constants.getSafeAreaInsets().bottom : Constants.isIOS ? 20 : 0);
|
|
33
|
-
const thresholdX = useRef(0);
|
|
34
|
-
const thresholdY = useRef(0);
|
|
35
|
-
const dragsCounter = useRef(0);
|
|
36
|
-
const containerRef = useRef();
|
|
37
|
-
const animatedValue = useRef(new Animated.Value(0));
|
|
38
|
-
const mutableSwipeDirections = useRef({});
|
|
39
|
-
const prevDragDeltas = useRef();
|
|
40
|
-
const prevSwipeDirections = useRef();
|
|
41
|
-
const visible = useRef(Boolean(propsVisible));
|
|
42
|
-
const getHiddenLocation = useCallback((left, top) => {
|
|
43
|
-
const result = {
|
|
44
|
-
left: 0,
|
|
45
|
-
top: 0
|
|
46
|
-
};
|
|
47
|
-
switch (direction) {
|
|
48
|
-
case PanningProvider.Directions.LEFT:
|
|
49
|
-
result.left = -left - width.current;
|
|
50
|
-
break;
|
|
51
|
-
case PanningProvider.Directions.RIGHT:
|
|
52
|
-
result.left = Constants.screenWidth - left;
|
|
53
|
-
break;
|
|
54
|
-
case PanningProvider.Directions.UP:
|
|
55
|
-
result.top = -top - height.current - TOP_INSET.current;
|
|
56
|
-
break;
|
|
57
|
-
case PanningProvider.Directions.DOWN:
|
|
58
|
-
default:
|
|
59
|
-
result.top = Constants.screenHeight - top + BOTTOM_INSET.current;
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
return result;
|
|
63
|
-
}, [direction]);
|
|
64
|
-
const hiddenLocation = useRef(getHiddenLocation(0, 0));
|
|
65
|
-
const animateTo = useCallback((toValue, animationEndCallback) => {
|
|
66
|
-
Animated.timing(animatedValue.current, {
|
|
67
|
-
toValue,
|
|
68
|
-
duration: 300,
|
|
69
|
-
easing: Easing.bezier(0.2, 0, 0.35, 1),
|
|
70
|
-
useNativeDriver: true
|
|
71
|
-
}).start(animationEndCallback);
|
|
72
|
-
}, []);
|
|
73
|
-
const isSwiping = useCallback(() => {
|
|
74
|
-
return !_isUndefined(mutableSwipeDirections.current.x) || !_isUndefined(mutableSwipeDirections.current.y);
|
|
75
|
-
}, []);
|
|
76
|
-
const resetSwipe = useCallback(() => {
|
|
77
|
-
dragsCounter.current = 0;
|
|
78
|
-
mutableSwipeDirections.current = {};
|
|
79
|
-
}, []);
|
|
80
|
-
const onDrag = useCallback(() => {
|
|
81
|
-
if (isSwiping()) {
|
|
82
|
-
if (dragsCounter.current < MAXIMUM_DRAGS_AFTER_SWIPE) {
|
|
83
|
-
dragsCounter.current += 1;
|
|
84
|
-
} else {
|
|
85
|
-
resetSwipe();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}, [isSwiping, resetSwipe]);
|
|
89
|
-
const hide = useCallback(() => {
|
|
90
|
-
// TODO: test we're not animating?
|
|
91
|
-
animateTo(0, () => {
|
|
92
|
-
visible.current = false;
|
|
93
|
-
onDismiss?.();
|
|
94
|
-
});
|
|
95
|
-
}, [animateTo, onDismiss]);
|
|
96
|
-
useEffect(() => {
|
|
97
|
-
if (isPanning && (dragDeltas.x || dragDeltas.y) && (dragDeltas.x !== prevDragDeltas.current?.x || dragDeltas.y !== prevDragDeltas.current?.y)) {
|
|
98
|
-
onDrag();
|
|
99
|
-
prevDragDeltas.current = dragDeltas;
|
|
100
|
-
}
|
|
101
|
-
}, [isPanning, dragDeltas, onDrag, hide]);
|
|
102
|
-
useEffect(() => {
|
|
103
|
-
if (isPanning && (swipeDirections.x || swipeDirections.y) && (swipeDirections.x !== prevSwipeDirections.current?.x || swipeDirections.y !== prevSwipeDirections.current?.y)) {
|
|
104
|
-
mutableSwipeDirections.current = swipeDirections;
|
|
105
|
-
}
|
|
106
|
-
}, [isPanning, swipeDirections, hide]);
|
|
107
|
-
useEffect(() => {
|
|
108
|
-
if (visible.current && !propsVisible) {
|
|
109
|
-
hide();
|
|
110
|
-
}
|
|
111
|
-
}, [propsVisible, hide]);
|
|
112
|
-
const onLayout = useCallback(event => {
|
|
113
|
-
// DO NOT move the width\height into the measureInWindow - it causes errors with orientation change
|
|
114
|
-
const layout = event.nativeEvent.layout;
|
|
115
|
-
width.current = layout.width;
|
|
116
|
-
height.current = layout.height;
|
|
117
|
-
thresholdX.current = width.current / 2;
|
|
118
|
-
thresholdY.current = height.current / 2;
|
|
119
|
-
if (containerRef.current) {
|
|
120
|
-
// @ts-ignore TODO: can we fix this on ViewProps \ View?
|
|
121
|
-
containerRef.current.measureInWindow((x, y) => {
|
|
122
|
-
hiddenLocation.current = getHiddenLocation(x, y);
|
|
123
|
-
animateTo(1);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}, [getHiddenLocation, animateTo]);
|
|
127
|
-
const getAnimationStyle = useCallback(() => {
|
|
128
|
-
return {
|
|
129
|
-
transform: [{
|
|
130
|
-
translateX: animatedValue.current.interpolate({
|
|
131
|
-
inputRange: [0, 1],
|
|
132
|
-
outputRange: [hiddenLocation.current.left, 0]
|
|
133
|
-
})
|
|
134
|
-
}, {
|
|
135
|
-
translateY: animatedValue.current.interpolate({
|
|
136
|
-
inputRange: [0, 1],
|
|
137
|
-
outputRange: [hiddenLocation.current.top, 0]
|
|
138
|
-
})
|
|
139
|
-
}]
|
|
140
|
-
};
|
|
141
|
-
}, []);
|
|
142
|
-
const resetToShown = useCallback((left, top, direction) => {
|
|
143
|
-
const toValue =
|
|
144
|
-
//@ts-expect-error
|
|
145
|
-
[PanningProvider.Directions.LEFT, PanningProvider.Directions.RIGHT].includes(direction) ? 1 + left / hiddenLocation.current.left : 1 + top / hiddenLocation.current.top;
|
|
146
|
-
animateTo(toValue);
|
|
147
|
-
}, [animateTo]);
|
|
148
|
-
const onPanLocationChanged = useCallback(({
|
|
149
|
-
left = 0,
|
|
150
|
-
top = 0
|
|
151
|
-
}) => {
|
|
152
|
-
const endValue = {
|
|
153
|
-
x: Math.round(left),
|
|
154
|
-
y: Math.round(top)
|
|
155
|
-
};
|
|
156
|
-
if (isSwiping()) {
|
|
157
|
-
hide();
|
|
158
|
-
} else {
|
|
159
|
-
resetSwipe();
|
|
160
|
-
if (direction === PanningProvider.Directions.LEFT && endValue.x <= -thresholdX.current || direction === PanningProvider.Directions.RIGHT && endValue.x >= thresholdX.current || direction === PanningProvider.Directions.UP && endValue.y <= -thresholdY.current || direction === PanningProvider.Directions.DOWN && endValue.y >= thresholdY.current) {
|
|
161
|
-
hide();
|
|
162
|
-
} else {
|
|
163
|
-
resetToShown(left, top, direction);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}, [isSwiping, hide, resetSwipe, direction, resetToShown]);
|
|
167
|
-
return (
|
|
168
|
-
// @ts-ignore
|
|
169
|
-
<View ref={containerRef} style={containerStyle} onLayout={onLayout}>
|
|
170
|
-
<PanResponderView
|
|
171
|
-
// !visible.current && styles.hidden is done to fix a bug is iOS
|
|
172
|
-
style={[style, getAnimationStyle(), !visible.current && styles.hidden]} isAnimated onPanLocationChanged={onPanLocationChanged}>
|
|
173
|
-
{children}
|
|
174
|
-
</PanResponderView>
|
|
175
|
-
</View>
|
|
176
|
-
);
|
|
177
|
-
};
|
|
178
|
-
DialogDismissibleView.displayName = 'IGNORE';
|
|
179
|
-
export default DialogDismissibleView;
|
|
180
|
-
const styles = StyleSheet.create({
|
|
181
|
-
hidden: {
|
|
182
|
-
opacity: 0
|
|
183
|
-
}
|
|
184
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
interface Props {
|
|
3
|
-
testID?: string;
|
|
4
|
-
dialogVisibility?: boolean;
|
|
5
|
-
modalVisibility?: boolean;
|
|
6
|
-
overlayBackgroundColor?: string;
|
|
7
|
-
onFadeDone?: () => void;
|
|
8
|
-
fadeOut?: boolean;
|
|
9
|
-
}
|
|
10
|
-
declare const OverlayFadingBackground: {
|
|
11
|
-
({ testID, dialogVisibility, modalVisibility, overlayBackgroundColor, onFadeDone: propsOnFadeDone, fadeOut }: Props): React.JSX.Element;
|
|
12
|
-
displayName: string;
|
|
13
|
-
};
|
|
14
|
-
export default OverlayFadingBackground;
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useEffect, useCallback, useMemo } from 'react';
|
|
2
|
-
import View from "../view";
|
|
3
|
-
import { Animated } from 'react-native';
|
|
4
|
-
const OverlayFadingBackground = ({
|
|
5
|
-
testID,
|
|
6
|
-
dialogVisibility,
|
|
7
|
-
modalVisibility,
|
|
8
|
-
overlayBackgroundColor,
|
|
9
|
-
onFadeDone: propsOnFadeDone,
|
|
10
|
-
fadeOut
|
|
11
|
-
}) => {
|
|
12
|
-
const fadeAnimation = useRef(new Animated.Value(0)).current;
|
|
13
|
-
const isAnimating = useRef(false);
|
|
14
|
-
const onFadeDone = useCallback(() => {
|
|
15
|
-
isAnimating.current = false;
|
|
16
|
-
propsOnFadeDone?.();
|
|
17
|
-
}, [propsOnFadeDone]);
|
|
18
|
-
const animateFading = useCallback(toValue => {
|
|
19
|
-
isAnimating.current = true;
|
|
20
|
-
Animated.timing(fadeAnimation, {
|
|
21
|
-
toValue,
|
|
22
|
-
duration: 400,
|
|
23
|
-
useNativeDriver: true
|
|
24
|
-
}).start(onFadeDone);
|
|
25
|
-
}, [fadeAnimation, onFadeDone]);
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (!isAnimating.current && (!dialogVisibility || fadeOut)) {
|
|
28
|
-
animateFading(0);
|
|
29
|
-
}
|
|
30
|
-
}, [dialogVisibility, animateFading, fadeOut]);
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (modalVisibility) {
|
|
33
|
-
animateFading(1);
|
|
34
|
-
}
|
|
35
|
-
}, [modalVisibility, animateFading]);
|
|
36
|
-
const style = useMemo(() => {
|
|
37
|
-
return {
|
|
38
|
-
opacity: fadeAnimation,
|
|
39
|
-
backgroundColor: overlayBackgroundColor
|
|
40
|
-
};
|
|
41
|
-
}, [overlayBackgroundColor, fadeAnimation]);
|
|
42
|
-
return <View testID={testID} absF animated style={style} pointerEvents="none" />;
|
|
43
|
-
};
|
|
44
|
-
OverlayFadingBackground.displayName = 'IGNORE';
|
|
45
|
-
export default OverlayFadingBackground;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import React, { Component } from 'react';
|
|
2
|
-
import PanningContext from "./panningContext";
|
|
3
|
-
function asPanViewConsumer(WrappedComponent) {
|
|
4
|
-
class PanViewConsumer extends Component {
|
|
5
|
-
saveRef = r => {
|
|
6
|
-
this.contentRef = r;
|
|
7
|
-
};
|
|
8
|
-
render() {
|
|
9
|
-
return <PanningContext.Consumer>
|
|
10
|
-
{context => <WrappedComponent ref={this.saveRef} context={context} {...this.props} />}
|
|
11
|
-
</PanningContext.Consumer>;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
return PanViewConsumer;
|
|
15
|
-
}
|
|
16
|
-
export default asPanViewConsumer;
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
-
import { PanningDirections, PanAmountsProps } from './panningProvider';
|
|
4
|
-
export interface DismissibleAnimationProps {
|
|
5
|
-
/**
|
|
6
|
-
* The return animation speed (default is 20)
|
|
7
|
-
*/
|
|
8
|
-
speed?: number;
|
|
9
|
-
/**
|
|
10
|
-
* The return animation bounciness (default is 6)
|
|
11
|
-
*/
|
|
12
|
-
bounciness?: number;
|
|
13
|
-
/**
|
|
14
|
-
* The dismiss animation duration (default is 280)
|
|
15
|
-
*/
|
|
16
|
-
duration?: number;
|
|
17
|
-
}
|
|
18
|
-
export interface PanDismissibleViewProps {
|
|
19
|
-
/**
|
|
20
|
-
* Additional styling
|
|
21
|
-
*/
|
|
22
|
-
style?: StyleProp<ViewStyle>;
|
|
23
|
-
/**
|
|
24
|
-
* The directions of the allowed pan (default allows all directions)
|
|
25
|
-
* Types: UP, DOWN, LEFT and RIGHT (using PanningProvider.Directions.###)
|
|
26
|
-
*/
|
|
27
|
-
directions?: PanningDirections[];
|
|
28
|
-
/**
|
|
29
|
-
* onDismiss callback
|
|
30
|
-
*/
|
|
31
|
-
onDismiss?: () => void;
|
|
32
|
-
/**
|
|
33
|
-
* Some animation options to choose from, defaults are set for:
|
|
34
|
-
* speed - the animation speed (default is 20)
|
|
35
|
-
* bounciness - the animation bounciness (default is 6)
|
|
36
|
-
* duration - the dismiss animation duration (default is 280)
|
|
37
|
-
*/
|
|
38
|
-
animationOptions?: DismissibleAnimationProps;
|
|
39
|
-
/**
|
|
40
|
-
* Override the default threshold (height/2 and width/2) with different values.
|
|
41
|
-
*/
|
|
42
|
-
threshold?: PanAmountsProps;
|
|
43
|
-
/**
|
|
44
|
-
* Allow diagonal dismiss, this is false by default,
|
|
45
|
-
* since it looks better and most cases.
|
|
46
|
-
*/
|
|
47
|
-
allowDiagonalDismiss?: boolean;
|
|
48
|
-
children?: React.ReactNode;
|
|
49
|
-
}
|
|
50
|
-
declare const _default: React.ComponentClass<PanDismissibleViewProps, any>;
|
|
51
|
-
export default _default;
|