react-native-ui-lib 7.46.2-snapshot.7314 → 7.46.2-snapshot.7316
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/babel.config.js +0 -12
- package/index.js +0 -1
- package/lib/android/build.gradle +5 -5
- package/lib/android/src/main/java/com/wix/reactnativeuilib/UiLibPackageList.java +2 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/HighlighterViewManager.java +23 -31
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReactHacks.java +30 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/highlighterview/ReflectionUtils.java +34 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/keyboardinput/utils/RuntimeUtils.java +1 -1
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/DefaultKeyListener.java +33 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/KeyListenerProxy.java +53 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerModule.java +54 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/TextInputDelKeyHandlerPackage.java +28 -0
- package/lib/android/src/main/java/com/wix/reactnativeuilib/textinput/ViewUtils.java +36 -0
- package/lib/components/{HighlighterOverlayView/index.d.ts → HighlighterOverlayView.d.ts} +1 -1
- package/lib/components/HighlighterOverlayView.js +40 -0
- package/lib/components/{HighlighterOverlayView/index.web.d.ts → HighlighterOverlayView.web.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.android.d.ts +2 -5
- package/lib/components/Keyboard/KeyboardInput/CustomKeyboardView/CustomKeyboardView.android.js +28 -0
- package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.ios.d.ts +1 -1
- package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/CustomKeyboardView.ios.js +3 -3
- package/lib/components/Keyboard/{KeyboardAccessoryView/CustomKeyboardView → KeyboardInput}/CustomKeyboardViewBase.d.ts +0 -3
- package/lib/components/Keyboard/{KeyboardAccessoryView/CustomKeyboardView → KeyboardInput}/CustomKeyboardViewBase.js +1 -1
- package/lib/components/Keyboard/{KeyboardAccessoryView/index.d.ts → KeyboardInput/KeyboardAccessoryView.d.ts} +1 -11
- package/lib/components/Keyboard/{KeyboardAccessoryView/index.js → KeyboardInput/KeyboardAccessoryView.js} +5 -31
- package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/index.d.ts → KeyboardInput/KeyboardRegistry.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/index.js → KeyboardInput/KeyboardRegistry.js} +1 -1
- package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry → KeyboardInput}/__tests__/KeyboardRegistry.spec.js +1 -1
- package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/keyboardAccessoryView.api.json +5 -5
- package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry → KeyboardInput}/keyboardRegistry.api.json +9 -9
- package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.d.ts +11 -0
- package/lib/components/Keyboard/KeyboardInput/utils/KeyboardUtils.js +17 -0
- package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager → KeyboardInput/utils}/__tests__/EventEmitterManager.spec.js +1 -1
- package/lib/components/Keyboard/{KeyboardAwareInsetsView/index.d.ts → KeyboardTracking/KeyboardAwareInsetsView.d.ts} +1 -1
- package/lib/components/Keyboard/{KeyboardAwareInsetsView/index.js → KeyboardTracking/KeyboardAwareInsetsView.js} +1 -1
- package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.ios.d.ts +4 -1
- package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.ios.js +8 -5
- package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.d.ts +2 -2
- package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/keyboardTrackingView.api.json +20 -11
- package/lib/components/Keyboard/index.d.ts +6 -6
- package/lib/components/Keyboard/index.js +6 -6
- package/lib/components/SafeArea/SafeAreaInsetsManager.d.ts +7 -21
- package/lib/components/SafeArea/SafeAreaInsetsManager.js +31 -95
- package/lib/components/SafeArea/SafeAreaSpacerView.d.ts +2 -2
- package/lib/components/SafeArea/SafeAreaSpacerView.js +9 -63
- package/lib/components/index.d.ts +1 -1
- package/lib/components/index.js +1 -1
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomInputControllerTemp.m +8 -52
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.h +7 -1
- package/lib/ios/reactnativeuilib/keyboardinput/rctcustomInputcontroller/RCTCustomKeyboardViewControllerTemp.m +1 -1
- package/lib/ios/reactnativeuilib/keyboardtrackingview/KeyboardTrackingViewTempManager.m +41 -109
- package/lib/package.json +1 -1
- package/lib/react-native.config.js +3 -1
- package/metro.config.js +2 -2
- package/package.json +24 -24
- package/panningViews.d.ts +2 -0
- package/panningViews.js +1 -0
- package/react-native.config.js +3 -1
- package/sharedTransition.d.ts +2 -0
- package/sharedTransition.js +1 -0
- package/src/commons/Constants.js +5 -2
- package/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js +1 -5
- package/src/components/actionSheet/index.d.ts +12 -2
- package/src/components/actionSheet/index.js +42 -3
- package/src/components/badge/index.d.ts +47 -107
- package/src/components/button/button.api.json +6 -1
- package/src/components/button/index.d.ts +31 -53
- package/src/components/button/index.js +18 -1
- package/src/components/button/types.d.ts +5 -0
- package/src/components/colorPicker/ColorPickerDialog.d.ts +1 -1
- package/src/components/colorPicker/ColorPickerDialog.js +1 -1
- package/src/components/dateTimePicker/index.d.ts +5 -186
- package/src/components/dateTimePicker/index.js +4 -3
- package/src/components/dialog/DialogDismissibleView.d.ts +34 -0
- package/src/components/dialog/DialogDismissibleView.js +184 -0
- package/src/components/dialog/OverlayFadingBackground.d.ts +14 -0
- package/src/components/dialog/OverlayFadingBackground.js +45 -0
- package/src/components/dialog/dialog.api.json +37 -31
- package/src/components/dialog/index.d.ts +105 -13
- package/src/components/dialog/index.js +212 -204
- package/src/components/drawer/Swipeable.js +2 -1
- package/src/components/drawer/index.js +25 -31
- package/src/components/fadedScrollView/index.js +2 -7
- package/src/components/featureHighlight/index.d.ts +1 -1
- package/src/components/index.js +19 -0
- package/src/components/modal/index.d.ts +0 -5
- package/src/components/modal/index.js +10 -14
- package/src/components/modal/modal.api.json +0 -5
- package/src/components/panningViews/asPanViewConsumer.d.ts +3 -0
- package/src/components/panningViews/asPanViewConsumer.js +16 -0
- package/src/components/panningViews/panDismissibleView.d.ts +51 -0
- package/src/components/panningViews/panDismissibleView.js +350 -0
- package/src/components/panningViews/panGestureView.d.ts +23 -0
- package/src/components/panningViews/panGestureView.js +156 -0
- package/src/components/panningViews/panListenerView.d.ts +66 -0
- package/src/components/panningViews/panListenerView.js +155 -0
- package/src/components/panningViews/panResponderView.d.ts +19 -0
- package/src/components/panningViews/panResponderView.js +79 -0
- package/src/components/panningViews/panningContext.d.ts +3 -0
- package/src/components/panningViews/panningContext.js +4 -0
- package/src/components/panningViews/panningProvider.d.ts +73 -0
- package/src/components/panningViews/panningProvider.js +101 -0
- 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 +20 -6
- package/src/components/picker/PickerPresenter.d.ts +1 -0
- package/src/components/picker/PickerPresenter.js +23 -1
- package/src/components/picker/api/picker.api.json +1 -0
- package/src/components/picker/api/pickerItem.api.json +5 -0
- package/src/components/picker/helpers/useFieldType.d.ts +23 -53
- package/src/components/picker/helpers/usePickerLabel.d.ts +1 -1
- package/src/components/picker/helpers/usePickerLabel.js +3 -2
- package/src/components/picker/helpers/usePickerMigrationWarnings.d.ts +1 -1
- package/src/components/picker/helpers/usePickerMigrationWarnings.js +12 -0
- package/src/components/picker/helpers/usePickerSearch.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSearch.js +8 -4
- package/src/components/picker/helpers/usePickerSelection.d.ts +1 -1
- package/src/components/picker/helpers/usePickerSelection.js +10 -2
- package/src/components/picker/index.js +22 -4
- package/src/components/picker/types.d.ts +24 -1
- package/src/components/segmentedControl/index.js +3 -3
- package/src/components/sharedTransition/ShareTransitionContext.js +3 -0
- package/src/components/sharedTransition/SharedArea.js +153 -0
- package/src/components/sharedTransition/SourceElement.js +44 -0
- package/src/components/sharedTransition/TargetElement.js +38 -0
- package/src/components/sharedTransition/index.js +9 -0
- package/src/components/slider/GradientSlider.d.ts +1 -1
- package/src/components/sortableGridList/SortableItem.js +4 -13
- package/src/components/sortableList/SortableListItem.js +4 -13
- package/src/components/stackAggregator/index.js +11 -16
- 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 +1 -0
- 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 +46 -106
- package/src/components/textField/presets/underline.d.ts +46 -106
- package/src/components/textField/usePreset.d.ts +44 -72
- package/src/incubator/dialog/dialog.api.json +54 -0
- package/src/{components → incubator}/dialog/dialogHeader.api.json +2 -2
- package/src/incubator/dialog/index.d.ts +15 -0
- package/src/incubator/dialog/index.js +218 -0
- package/src/{components → incubator}/dialog/types.d.ts +19 -0
- package/src/{components → incubator}/dialog/types.js +3 -1
- package/src/{components → incubator}/dialog/useDialogContent.d.ts +1 -1
- package/src/incubator/expandableOverlay/ExpandableOverlay.driver.js +1 -1
- package/src/incubator/expandableOverlay/index.d.ts +3 -42
- package/src/incubator/expandableOverlay/index.js +4 -1
- package/src/{hooks/useHiddenLocation/index.d.ts → incubator/hooks/useHiddenLocation.d.ts} +1 -1
- package/src/{hooks/useHiddenLocation/index.web.d.ts → incubator/hooks/useHiddenLocation.web.d.ts} +1 -1
- package/src/incubator/index.d.ts +2 -0
- package/src/incubator/index.js +2 -0
- package/src/{components → incubator}/panView/index.d.ts +3 -3
- package/src/{components → incubator}/panView/index.js +4 -4
- package/src/{components → incubator}/panView/usePanGesture.d.ts +1 -1
- package/src/incubator/toast/index.js +1 -1
- package/src/index.d.ts +10 -3
- package/src/index.js +160 -41
- package/src/testkit/index.d.ts +1 -1
- package/src/testkit/index.js +1 -1
- package/src/testkit/new/Component.driver.d.ts +1 -4
- package/src/testkit/new/Component.driver.js +3 -3
- package/lib/components/HighlighterOverlayView/index.js +0 -49
- package/lib/components/Keyboard/KeyboardAccessoryView/CustomKeyboardView/CustomKeyboardView.android.js +0 -51
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.d.ts +0 -26
- package/lib/components/Keyboard/KeyboardAccessoryView/KeyboardUtils/index.js +0 -91
- package/lib/components/SafeArea/__tests__/SafeAreaInsetsManager.spec.js +0 -274
- package/lib/components/SafeArea/index.d.ts +0 -10
- package/lib/components/SafeArea/index.js +0 -11
- package/panView.d.ts +0 -2
- package/panView.js +0 -1
- /package/lib/components/{HighlighterOverlayView/index.web.js → HighlighterOverlayView.web.js} +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/CustomKeyboardView/index.web.js +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.android.js +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView → KeyboardInput}/TextInputKeyboardManager/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.d.ts → KeyboardInput/utils/EventEmitterManager.d.ts} +0 -0
- /package/lib/components/Keyboard/{KeyboardAccessoryView/KeyboardRegistry/EventEmitterManager/index.js → KeyboardInput/utils/EventEmitterManager.js} +0 -0
- /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/KeyboardTrackingView.android.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.js +0 -0
- /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.d.ts +0 -0
- /package/lib/components/Keyboard/{KeyboardTrackingView → KeyboardTracking/KeyboardTrackingView}/index.web.js +0 -0
- /package/lib/components/Keyboard/{KeyboardAwareInsetsView → KeyboardTracking}/keyboardAwareInsetsView.api.json +0 -0
- /package/src/{components → incubator}/dialog/Dialog.driver.new.d.ts +0 -0
- /package/src/{components → incubator}/dialog/Dialog.driver.new.js +0 -0
- /package/src/{components → incubator}/dialog/DialogHeader.d.ts +0 -0
- /package/src/{components → incubator}/dialog/DialogHeader.js +0 -0
- /package/src/{components → incubator}/dialog/useDialogContent.js +0 -0
- /package/src/{hooks/useHiddenLocation/index.js → incubator/hooks/useHiddenLocation.js} +0 -0
- /package/src/{hooks/useHiddenLocation/index.web.js → incubator/hooks/useHiddenLocation.web.js} +0 -0
- /package/src/{components → incubator}/panView/panningUtil.d.ts +0 -0
- /package/src/{components → incubator}/panView/panningUtil.js +0 -0
- /package/src/{components → incubator}/panView/usePanGesture.js +0 -0
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import _isUndefined from "lodash/isUndefined";
|
|
2
|
+
import React, { PureComponent } from 'react';
|
|
3
|
+
import { PanResponder } from 'react-native';
|
|
4
|
+
import asPanViewConsumer from "./asPanViewConsumer";
|
|
5
|
+
import PanningProvider from "./panningProvider";
|
|
6
|
+
import View from "../view";
|
|
7
|
+
const DEFAULT_DIRECTIONS = [PanningProvider.Directions.UP, PanningProvider.Directions.DOWN, PanningProvider.Directions.LEFT, PanningProvider.Directions.RIGHT];
|
|
8
|
+
const DEFAULT_PAN_SENSITIVITY = 5;
|
|
9
|
+
const DEFAULT_SWIPE_VELOCITY = 1.8;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @description: PanListenerView component created to making listening to swipe and drag events easier
|
|
13
|
+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/PanListenerScreen.tsx
|
|
14
|
+
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/PanListenerView/PanListenerView.gif?raw=true
|
|
15
|
+
*/
|
|
16
|
+
class PanListenerView extends PureComponent {
|
|
17
|
+
static displayName = 'IGNORE';
|
|
18
|
+
static defaultProps = {
|
|
19
|
+
directions: DEFAULT_DIRECTIONS,
|
|
20
|
+
panSensitivity: DEFAULT_PAN_SENSITIVITY,
|
|
21
|
+
swipeVelocitySensitivity: DEFAULT_SWIPE_VELOCITY
|
|
22
|
+
};
|
|
23
|
+
constructor(props) {
|
|
24
|
+
super(props);
|
|
25
|
+
const {
|
|
26
|
+
isClickable
|
|
27
|
+
} = props;
|
|
28
|
+
this.panResponder = PanResponder.create({
|
|
29
|
+
onStartShouldSetPanResponder: isClickable ? this.shouldPan : this.yes,
|
|
30
|
+
onMoveShouldSetPanResponder: this.shouldPan,
|
|
31
|
+
onStartShouldSetPanResponderCapture: this.no,
|
|
32
|
+
onMoveShouldSetPanResponderCapture: this.no,
|
|
33
|
+
onPanResponderGrant: this.handlePanStart,
|
|
34
|
+
onPanResponderMove: this.handlePanMove,
|
|
35
|
+
onPanResponderRelease: this.handlePanRelease,
|
|
36
|
+
onPanResponderTerminate: this.handlePanTerminate
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
yes = () => {
|
|
40
|
+
return true;
|
|
41
|
+
};
|
|
42
|
+
no = () => {
|
|
43
|
+
return false;
|
|
44
|
+
};
|
|
45
|
+
shouldPan = (_e, gestureState) => {
|
|
46
|
+
// return true if user is swiping, return false if it's a single click
|
|
47
|
+
const {
|
|
48
|
+
dy,
|
|
49
|
+
dx
|
|
50
|
+
} = gestureState;
|
|
51
|
+
const {
|
|
52
|
+
directions,
|
|
53
|
+
panSensitivity = DEFAULT_PAN_SENSITIVITY
|
|
54
|
+
} = this.props;
|
|
55
|
+
return Boolean(directions && (directions.includes(PanningProvider.Directions.UP) && dy < -panSensitivity || directions.includes(PanningProvider.Directions.DOWN) && dy > panSensitivity || directions.includes(PanningProvider.Directions.LEFT) && dx < -panSensitivity || directions.includes(PanningProvider.Directions.RIGHT) && dx > panSensitivity));
|
|
56
|
+
};
|
|
57
|
+
handlePanStart = () => {
|
|
58
|
+
this.props.onPanStart?.();
|
|
59
|
+
this.props.context?.onPanStart?.();
|
|
60
|
+
};
|
|
61
|
+
getSwipeDirection = ({
|
|
62
|
+
vx,
|
|
63
|
+
vy
|
|
64
|
+
}) => {
|
|
65
|
+
const {
|
|
66
|
+
swipeVelocitySensitivity = DEFAULT_SWIPE_VELOCITY
|
|
67
|
+
} = this.props;
|
|
68
|
+
return this.getDirectionsOverSensitivity(vx, vy, swipeVelocitySensitivity);
|
|
69
|
+
};
|
|
70
|
+
getDragDirection = ({
|
|
71
|
+
dx,
|
|
72
|
+
dy
|
|
73
|
+
}) => {
|
|
74
|
+
return this.getDirectionsOverSensitivity(dx, dy, 0);
|
|
75
|
+
};
|
|
76
|
+
getDirectionsOverSensitivity = (x, y, sensitivity) => {
|
|
77
|
+
const {
|
|
78
|
+
directions = DEFAULT_DIRECTIONS
|
|
79
|
+
} = this.props;
|
|
80
|
+
const selectedDirections = {};
|
|
81
|
+
const selectedAmounts = {};
|
|
82
|
+
if (directions.includes(PanningProvider.Directions.LEFT) && x < -sensitivity) {
|
|
83
|
+
selectedDirections.x = PanningProvider.Directions.LEFT;
|
|
84
|
+
selectedAmounts.x = x;
|
|
85
|
+
} else if (directions.includes(PanningProvider.Directions.RIGHT) && x > sensitivity) {
|
|
86
|
+
selectedDirections.x = PanningProvider.Directions.RIGHT;
|
|
87
|
+
selectedAmounts.x = x;
|
|
88
|
+
}
|
|
89
|
+
if (directions.includes(PanningProvider.Directions.UP) && y < -sensitivity) {
|
|
90
|
+
selectedDirections.y = PanningProvider.Directions.UP;
|
|
91
|
+
selectedAmounts.y = y;
|
|
92
|
+
} else if (directions.includes(PanningProvider.Directions.DOWN) && y > sensitivity) {
|
|
93
|
+
selectedDirections.y = PanningProvider.Directions.DOWN;
|
|
94
|
+
selectedAmounts.y = y;
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
selectedDirections,
|
|
98
|
+
selectedAmounts
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
panResultHasValue = panResult => {
|
|
102
|
+
return Boolean(panResult && (panResult.selectedDirections.x || panResult.selectedDirections.y));
|
|
103
|
+
};
|
|
104
|
+
handlePanMove = (_e, gestureState) => {
|
|
105
|
+
const {
|
|
106
|
+
onSwipe,
|
|
107
|
+
onDrag,
|
|
108
|
+
context
|
|
109
|
+
} = this.props;
|
|
110
|
+
const hasSwipe = !_isUndefined(onSwipe);
|
|
111
|
+
const hasDrag = !_isUndefined(onDrag);
|
|
112
|
+
const hasContext = !_isUndefined(context);
|
|
113
|
+
let panResult;
|
|
114
|
+
if (hasSwipe || hasContext) {
|
|
115
|
+
panResult = this.getSwipeDirection(gestureState);
|
|
116
|
+
}
|
|
117
|
+
if (this.panResultHasValue(panResult)) {
|
|
118
|
+
// @ts-ignore
|
|
119
|
+
const data = {
|
|
120
|
+
directions: panResult.selectedDirections,
|
|
121
|
+
velocities: panResult.selectedAmounts
|
|
122
|
+
};
|
|
123
|
+
this.props.onSwipe?.(data);
|
|
124
|
+
context?.onSwipe?.(data);
|
|
125
|
+
} else if (hasDrag || hasContext) {
|
|
126
|
+
panResult = this.getDragDirection(gestureState);
|
|
127
|
+
if (this.panResultHasValue(panResult)) {
|
|
128
|
+
const data = {
|
|
129
|
+
directions: panResult.selectedDirections,
|
|
130
|
+
deltas: panResult.selectedAmounts
|
|
131
|
+
};
|
|
132
|
+
this.props.onDrag?.(data);
|
|
133
|
+
context?.onDrag?.(data);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
handlePanRelease = () => {
|
|
138
|
+
this.props.onPanRelease?.();
|
|
139
|
+
this.props.context?.onPanRelease?.();
|
|
140
|
+
};
|
|
141
|
+
handlePanTerminate = () => {
|
|
142
|
+
this.props.onPanTerminated?.();
|
|
143
|
+
this.props.context?.onPanTerminated?.();
|
|
144
|
+
};
|
|
145
|
+
render() {
|
|
146
|
+
const {
|
|
147
|
+
children,
|
|
148
|
+
...others
|
|
149
|
+
} = this.props;
|
|
150
|
+
return <View {...others} {...this.panResponder.panHandlers}>
|
|
151
|
+
{children}
|
|
152
|
+
</View>;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
export default asPanViewConsumer(PanListenerView);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewProps } from '../view';
|
|
3
|
+
import { PanLocationProps } from './panningProvider';
|
|
4
|
+
export interface PanResponderViewProps extends ViewProps {
|
|
5
|
+
/**
|
|
6
|
+
* Will be called with the current location ({left, top}) when the pan has ended
|
|
7
|
+
*/
|
|
8
|
+
onPanLocationChanged?: (location: PanLocationProps) => void;
|
|
9
|
+
/**
|
|
10
|
+
* Ignore panning events while this is true
|
|
11
|
+
*/
|
|
12
|
+
ignorePanning?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Allow the view to be animated (send animation via style; default is false)
|
|
15
|
+
*/
|
|
16
|
+
isAnimated?: boolean;
|
|
17
|
+
}
|
|
18
|
+
declare const _default: React.ComponentClass<PanResponderViewProps, any>;
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import React, { PureComponent } from 'react';
|
|
2
|
+
import View from "../view";
|
|
3
|
+
import asPanViewConsumer from "./asPanViewConsumer";
|
|
4
|
+
/**
|
|
5
|
+
* @description: panResponderView component created to making listening to swipe and drag events easier.
|
|
6
|
+
* @notes: Has to be used as a child of a PanningProvider that also has a PanListenerView.
|
|
7
|
+
* The PanListenerView is the one that sends the drag\swipe events.
|
|
8
|
+
* @example: https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/PanResponderScreen.tsx
|
|
9
|
+
* @gif: https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/PanResponderView/PanResponderView.gif?raw=true
|
|
10
|
+
*/
|
|
11
|
+
class PanResponderView extends PureComponent {
|
|
12
|
+
static displayName = 'IGNORE';
|
|
13
|
+
static defaultProps = {
|
|
14
|
+
isAnimated: false
|
|
15
|
+
};
|
|
16
|
+
initialLeft = 0;
|
|
17
|
+
initialTop = 0;
|
|
18
|
+
ref = React.createRef();
|
|
19
|
+
componentDidMount() {
|
|
20
|
+
this.setNativeProps(this.initialLeft, this.initialTop);
|
|
21
|
+
}
|
|
22
|
+
componentDidUpdate(prevProps) {
|
|
23
|
+
const {
|
|
24
|
+
ignorePanning
|
|
25
|
+
} = this.props;
|
|
26
|
+
const {
|
|
27
|
+
isPanning,
|
|
28
|
+
dragDeltas
|
|
29
|
+
} = this.props.context;
|
|
30
|
+
const {
|
|
31
|
+
isPanning: prevIsPanning,
|
|
32
|
+
dragDeltas: prevDragDeltas
|
|
33
|
+
} = prevProps.context;
|
|
34
|
+
if (!ignorePanning && !isPanning && prevIsPanning) {
|
|
35
|
+
this.onPanEnd();
|
|
36
|
+
}
|
|
37
|
+
if (!ignorePanning && isPanning && (dragDeltas.x || dragDeltas.y) && (dragDeltas.x !== prevDragDeltas.x || dragDeltas.y !== prevDragDeltas.y)) {
|
|
38
|
+
this.onDrag(dragDeltas);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
onPanEnd() {
|
|
42
|
+
const location = {
|
|
43
|
+
left: this.left,
|
|
44
|
+
top: this.top
|
|
45
|
+
};
|
|
46
|
+
this.initialLeft = this.left || this.initialLeft;
|
|
47
|
+
this.initialTop = this.top || this.initialTop;
|
|
48
|
+
this.props.onPanLocationChanged?.(location);
|
|
49
|
+
//@ts-expect-error
|
|
50
|
+
this.props.context.onPanLocationChanged?.(location);
|
|
51
|
+
}
|
|
52
|
+
onDrag(deltas) {
|
|
53
|
+
const left = this.initialLeft + (deltas.x ? Math.round(deltas.x) : 0);
|
|
54
|
+
const top = this.initialTop + (deltas.y ? Math.round(deltas.y) : 0);
|
|
55
|
+
this.setNativeProps(left, top);
|
|
56
|
+
}
|
|
57
|
+
setNativeProps(left, top) {
|
|
58
|
+
if (this.ref.current) {
|
|
59
|
+
this.ref.current?.setNativeProps?.({
|
|
60
|
+
style: {
|
|
61
|
+
left,
|
|
62
|
+
top
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
this.left = left;
|
|
66
|
+
this.top = top;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
render() {
|
|
70
|
+
const {
|
|
71
|
+
isAnimated,
|
|
72
|
+
...others
|
|
73
|
+
} = this.props;
|
|
74
|
+
return <View animated={isAnimated} ref={this.ref} pointerEvents={'box-none'} {...others}>
|
|
75
|
+
{this.props.children}
|
|
76
|
+
</View>;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
export default asPanViewConsumer(PanResponderView);
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
export declare enum PanningDirectionsEnum {
|
|
3
|
+
UP = "up",
|
|
4
|
+
DOWN = "down",
|
|
5
|
+
LEFT = "left",
|
|
6
|
+
RIGHT = "right"
|
|
7
|
+
}
|
|
8
|
+
export type PanningDirectionsUnion = `${PanningDirectionsEnum}`;
|
|
9
|
+
export type PanningDirections = PanningDirectionsEnum | PanningDirectionsUnion;
|
|
10
|
+
export interface PanLocationProps {
|
|
11
|
+
left?: number;
|
|
12
|
+
top?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PanDirectionsProps {
|
|
15
|
+
x?: PanningDirections;
|
|
16
|
+
y?: PanningDirections;
|
|
17
|
+
}
|
|
18
|
+
export interface PanAmountsProps {
|
|
19
|
+
x?: number;
|
|
20
|
+
y?: number;
|
|
21
|
+
}
|
|
22
|
+
interface State {
|
|
23
|
+
isPanning: boolean;
|
|
24
|
+
wasTerminated: boolean;
|
|
25
|
+
dragDirections: PanDirectionsProps;
|
|
26
|
+
dragDeltas: PanAmountsProps;
|
|
27
|
+
swipeDirections: PanDirectionsProps;
|
|
28
|
+
swipeVelocities: PanAmountsProps;
|
|
29
|
+
panLocation: PanLocationProps;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @description: Wraps the panResponderView and panListenerView to provide a shared context
|
|
33
|
+
*/
|
|
34
|
+
export default class PanningProvider extends Component<any, State> {
|
|
35
|
+
static displayName: string;
|
|
36
|
+
static Directions: typeof PanningDirectionsEnum;
|
|
37
|
+
constructor(props: any);
|
|
38
|
+
getProviderContextValue: () => {
|
|
39
|
+
onPanStart: () => void;
|
|
40
|
+
onPanRelease: () => void;
|
|
41
|
+
onPanTerminated: () => void;
|
|
42
|
+
isPanning: boolean;
|
|
43
|
+
wasTerminated: boolean;
|
|
44
|
+
onDrag: ({ directions, deltas }: {
|
|
45
|
+
directions: PanDirectionsProps;
|
|
46
|
+
deltas: PanAmountsProps;
|
|
47
|
+
}) => void;
|
|
48
|
+
dragDirections: PanDirectionsProps;
|
|
49
|
+
dragDeltas: PanAmountsProps;
|
|
50
|
+
onSwipe: ({ directions, velocities }: {
|
|
51
|
+
directions: PanDirectionsProps;
|
|
52
|
+
velocities: PanAmountsProps;
|
|
53
|
+
}) => void;
|
|
54
|
+
swipeDirections: PanDirectionsProps;
|
|
55
|
+
swipeVelocities: PanAmountsProps;
|
|
56
|
+
onPanLocationChanged: (location: PanLocationProps) => void;
|
|
57
|
+
panLocation: PanLocationProps;
|
|
58
|
+
};
|
|
59
|
+
onPanStart: () => void;
|
|
60
|
+
onPanRelease: () => void;
|
|
61
|
+
onPanTerminated: () => void;
|
|
62
|
+
onDrag: ({ directions, deltas }: {
|
|
63
|
+
directions: PanDirectionsProps;
|
|
64
|
+
deltas: PanAmountsProps;
|
|
65
|
+
}) => void;
|
|
66
|
+
onSwipe: ({ directions, velocities }: {
|
|
67
|
+
directions: PanDirectionsProps;
|
|
68
|
+
velocities: PanAmountsProps;
|
|
69
|
+
}) => void;
|
|
70
|
+
onPanLocationChanged: (location: PanLocationProps) => void;
|
|
71
|
+
render(): React.JSX.Element;
|
|
72
|
+
}
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import PanningContext from "./panningContext";
|
|
3
|
+
export let PanningDirectionsEnum = /*#__PURE__*/function (PanningDirectionsEnum) {
|
|
4
|
+
PanningDirectionsEnum["UP"] = "up";
|
|
5
|
+
PanningDirectionsEnum["DOWN"] = "down";
|
|
6
|
+
PanningDirectionsEnum["LEFT"] = "left";
|
|
7
|
+
PanningDirectionsEnum["RIGHT"] = "right";
|
|
8
|
+
return PanningDirectionsEnum;
|
|
9
|
+
}({});
|
|
10
|
+
/**
|
|
11
|
+
* @description: Wraps the panResponderView and panListenerView to provide a shared context
|
|
12
|
+
*/
|
|
13
|
+
export default class PanningProvider extends Component {
|
|
14
|
+
static displayName = 'IGNORE';
|
|
15
|
+
static Directions = PanningDirectionsEnum;
|
|
16
|
+
constructor(props) {
|
|
17
|
+
super(props);
|
|
18
|
+
this.state = {
|
|
19
|
+
isPanning: false,
|
|
20
|
+
wasTerminated: false,
|
|
21
|
+
dragDirections: {},
|
|
22
|
+
dragDeltas: {},
|
|
23
|
+
swipeDirections: {},
|
|
24
|
+
swipeVelocities: {},
|
|
25
|
+
panLocation: {}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
getProviderContextValue = () => {
|
|
29
|
+
const {
|
|
30
|
+
isPanning,
|
|
31
|
+
wasTerminated,
|
|
32
|
+
dragDirections,
|
|
33
|
+
dragDeltas,
|
|
34
|
+
swipeDirections,
|
|
35
|
+
swipeVelocities,
|
|
36
|
+
panLocation
|
|
37
|
+
} = this.state;
|
|
38
|
+
return {
|
|
39
|
+
onPanStart: this.onPanStart,
|
|
40
|
+
onPanRelease: this.onPanRelease,
|
|
41
|
+
onPanTerminated: this.onPanTerminated,
|
|
42
|
+
isPanning,
|
|
43
|
+
wasTerminated,
|
|
44
|
+
onDrag: this.onDrag,
|
|
45
|
+
dragDirections,
|
|
46
|
+
dragDeltas,
|
|
47
|
+
onSwipe: this.onSwipe,
|
|
48
|
+
swipeDirections,
|
|
49
|
+
swipeVelocities,
|
|
50
|
+
onPanLocationChanged: this.onPanLocationChanged,
|
|
51
|
+
panLocation
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
onPanStart = () => {
|
|
55
|
+
this.setState({
|
|
56
|
+
isPanning: true,
|
|
57
|
+
wasTerminated: false
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
onPanRelease = () => {
|
|
61
|
+
this.setState({
|
|
62
|
+
isPanning: false
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
onPanTerminated = () => {
|
|
66
|
+
this.setState({
|
|
67
|
+
isPanning: false,
|
|
68
|
+
wasTerminated: true
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
onDrag = ({
|
|
72
|
+
directions,
|
|
73
|
+
deltas
|
|
74
|
+
}) => {
|
|
75
|
+
this.setState({
|
|
76
|
+
dragDirections: directions,
|
|
77
|
+
dragDeltas: deltas,
|
|
78
|
+
swipeDirections: {},
|
|
79
|
+
swipeVelocities: {}
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
onSwipe = ({
|
|
83
|
+
directions,
|
|
84
|
+
velocities
|
|
85
|
+
}) => {
|
|
86
|
+
this.setState({
|
|
87
|
+
swipeDirections: directions,
|
|
88
|
+
swipeVelocities: velocities,
|
|
89
|
+
dragDirections: {},
|
|
90
|
+
dragDeltas: {}
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
onPanLocationChanged = location => {
|
|
94
|
+
this.setState({
|
|
95
|
+
panLocation: location
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
render() {
|
|
99
|
+
return <PanningContext.Provider value={this.getProviderContextValue()}>{this.props.children}</PanningContext.Provider>;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const PickerDriver: (props: ComponentProps, useDialog: boolean
|
|
1
|
+
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
+
export declare const PickerDriver: (props: ComponentProps, useDialog: boolean) => {
|
|
3
3
|
exists: () => boolean;
|
|
4
4
|
getValue: () => string | undefined;
|
|
5
5
|
open: () => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TextFieldDriver } from "../textField/TextField.driver.new";
|
|
2
2
|
import { ModalDriver } from "../modal/Modal.driver.new";
|
|
3
|
-
import { DialogDriver } from "
|
|
3
|
+
import { DialogDriver } from "../../incubator/dialog/Dialog.driver.new";
|
|
4
4
|
import { ButtonDriver } from "../button/Button.driver.new";
|
|
5
5
|
import { ExpandableOverlayDriver } from "../../incubator/expandableOverlay/ExpandableOverlay.driver";
|
|
6
|
-
export const PickerDriver = (props, useDialog
|
|
6
|
+
export const PickerDriver = (props, useDialog) => {
|
|
7
7
|
const expandableOverlayDriver = ExpandableOverlayDriver({
|
|
8
8
|
renderTree: props.renderTree,
|
|
9
9
|
testID: props.testID
|
|
@@ -11,7 +11,7 @@ export const PickerDriver = (props, useDialog, options) => {
|
|
|
11
11
|
const textFieldDriver = TextFieldDriver({
|
|
12
12
|
renderTree: props.renderTree,
|
|
13
13
|
testID: `${props.testID}.input`
|
|
14
|
-
}
|
|
14
|
+
});
|
|
15
15
|
const modalDriver = ModalDriver({
|
|
16
16
|
renderTree: props.renderTree,
|
|
17
17
|
testID: `${props.testID}.overlay`
|
|
@@ -11,7 +11,7 @@ import View from "../view";
|
|
|
11
11
|
import TouchableOpacity from "../touchableOpacity";
|
|
12
12
|
import Image from "../image";
|
|
13
13
|
import Text from "../text";
|
|
14
|
-
import { isItemSelected } from "./PickerPresenter";
|
|
14
|
+
import { getItemLabel, isItemSelected } from "./PickerPresenter";
|
|
15
15
|
import PickerContext from "./PickerContext";
|
|
16
16
|
/**
|
|
17
17
|
* @description: Picker.Item, for configuring the Picker's selectable options
|
|
@@ -29,8 +29,14 @@ const PickerItem = props => {
|
|
|
29
29
|
testID
|
|
30
30
|
} = props;
|
|
31
31
|
const context = useContext(PickerContext);
|
|
32
|
+
const {
|
|
33
|
+
migrate
|
|
34
|
+
} = context;
|
|
32
35
|
const customRenderItem = props.renderItem || context.renderItem;
|
|
33
|
-
|
|
36
|
+
// @ts-expect-error TODO: fix after removing migrate prop completely
|
|
37
|
+
const itemValue = !migrate && typeof value === 'object' ? value?.value : value;
|
|
38
|
+
const isSelected = isItemSelected(itemValue, context.value);
|
|
39
|
+
const itemLabel = getItemLabel(label, value, props.getItemLabel || context.getItemLabel);
|
|
34
40
|
const selectedCounter = context.selectionLimit && _isArray(context.value) && context.value?.length;
|
|
35
41
|
const accessibilityProps = {
|
|
36
42
|
accessibilityState: isSelected ? {
|
|
@@ -61,15 +67,23 @@ const PickerItem = props => {
|
|
|
61
67
|
if (onPress && (await onPress(context.isMultiMode ? !isSelected : undefined, props)) === false) {
|
|
62
68
|
return;
|
|
63
69
|
}
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
if (migrate) {
|
|
71
|
+
context.onPress(value);
|
|
72
|
+
} else {
|
|
73
|
+
// @ts-expect-error TODO: fix after removing migrate prop completely
|
|
74
|
+
context.onPress(typeof value === 'object' || context.isMultiMode ? value : {
|
|
75
|
+
value,
|
|
76
|
+
label: itemLabel
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}, [migrate, value, context.onPress, onPress]);
|
|
66
80
|
const onSelectedLayout = useCallback((...args) => {
|
|
67
81
|
_invoke(context, 'onSelectedLayout', ...args);
|
|
68
82
|
}, []);
|
|
69
83
|
const _renderItem = () => {
|
|
70
84
|
return <View style={styles.container} flex row spread centerV>
|
|
71
85
|
<Text numberOfLines={1} style={itemLabelStyle}>
|
|
72
|
-
{
|
|
86
|
+
{itemLabel}
|
|
73
87
|
</Text>
|
|
74
88
|
{selectedIndicator}
|
|
75
89
|
</View>;
|
|
@@ -79,7 +93,7 @@ const PickerItem = props => {
|
|
|
79
93
|
...props,
|
|
80
94
|
isSelected,
|
|
81
95
|
isItemDisabled
|
|
82
|
-
},
|
|
96
|
+
}, itemLabel) : _renderItem()}
|
|
83
97
|
</TouchableOpacity>;
|
|
84
98
|
};
|
|
85
99
|
const styles = StyleSheet.create({
|
|
@@ -4,4 +4,5 @@ export declare function extractPickerItems(props: PickerProps): {
|
|
|
4
4
|
label: any;
|
|
5
5
|
}[];
|
|
6
6
|
export declare function isItemSelected(childValue: PickerSingleValue, selectedValue?: PickerValue): boolean;
|
|
7
|
+
export declare function getItemLabel(label: string, value: PickerValue, getItemLabel?: PickerProps['getItemLabel']): string | undefined;
|
|
7
8
|
export declare function shouldFilterOut(searchValue: string, itemLabel?: string): boolean;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import _lowerCase from "lodash/lowerCase";
|
|
2
2
|
import _includes from "lodash/includes";
|
|
3
|
+
import _get from "lodash/get";
|
|
4
|
+
import _isObject from "lodash/isObject";
|
|
3
5
|
import _find from "lodash/find";
|
|
4
6
|
import React from 'react';
|
|
5
7
|
export function extractPickerItems(props) {
|
|
@@ -18,13 +20,33 @@ export function isItemSelected(childValue, selectedValue) {
|
|
|
18
20
|
let isSelected = false;
|
|
19
21
|
if (Array.isArray(selectedValue)) {
|
|
20
22
|
isSelected = _find(selectedValue, v => {
|
|
21
|
-
|
|
23
|
+
// @ts-expect-error TODO: fix after removing migrate prop completely
|
|
24
|
+
return v === childValue || typeof v === 'object' && v?.value === childValue;
|
|
22
25
|
}) !== undefined;
|
|
23
26
|
} else {
|
|
24
27
|
isSelected = childValue === selectedValue;
|
|
25
28
|
}
|
|
26
29
|
return isSelected;
|
|
27
30
|
}
|
|
31
|
+
|
|
32
|
+
// export function getItemValue(props) {
|
|
33
|
+
// if (_.isArray(props.value)) {
|
|
34
|
+
// return props.getItemValue ? _.map(props.value, item => props.getItemValue(item)) : _.map(props.value, 'value');
|
|
35
|
+
// } else if (!_.isObject(props.value)) {
|
|
36
|
+
// return props.value;
|
|
37
|
+
// }
|
|
38
|
+
// return _.invoke(props, 'getItemValue', props.value) || _.get(props.value, 'value');
|
|
39
|
+
// }
|
|
40
|
+
|
|
41
|
+
export function getItemLabel(label, value, getItemLabel) {
|
|
42
|
+
if (_isObject(value)) {
|
|
43
|
+
if (getItemLabel) {
|
|
44
|
+
return getItemLabel(value);
|
|
45
|
+
}
|
|
46
|
+
return _get(value, 'label');
|
|
47
|
+
}
|
|
48
|
+
return label;
|
|
49
|
+
}
|
|
28
50
|
export function shouldFilterOut(searchValue, itemLabel) {
|
|
29
51
|
return !_includes(_lowerCase(itemLabel), _lowerCase(searchValue));
|
|
30
52
|
}
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"https://github.com/wix/react-native-ui-lib/blob/master/demo/showcase/Picker/CustomPicker.gif?raw=true"
|
|
12
12
|
],
|
|
13
13
|
"props": [
|
|
14
|
+
{"name": "migrate", "type": "boolean", "description": "Temporary prop required for migration to Picker's new API"},
|
|
14
15
|
{"name": "value", "type": "string | number", "description": "Picker current value"},
|
|
15
16
|
{
|
|
16
17
|
"name": "onChange",
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
{"name": "value", "type": "string | number", "description": "Item's value"},
|
|
14
14
|
{"name": "label", "type": "string", "description": "Item's label"},
|
|
15
15
|
{"name": "labelStyle", "type": "ViewStyle", "description": "Item's label style"},
|
|
16
|
+
{
|
|
17
|
+
"name": "getItemLabel",
|
|
18
|
+
"type": "(value: string | number) => string",
|
|
19
|
+
"description": "Custom function for the item label"
|
|
20
|
+
},
|
|
16
21
|
{"name": "isSelected", "type": "boolean", "description": "Is the item selected"},
|
|
17
22
|
{"name": "selectedIcon", "type": "string", "description": "Pass to change the selected icon"},
|
|
18
23
|
{"name": "selectedIconColor", "type": "ImageSource", "description": "Pass to change the selected icon color"},
|