react-native-ui-lib 7.41.1-snapshot.6966 → 7.41.1
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/lib/components/Keyboard/KeyboardInput/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +1 -1
- package/lib/package.json +1 -1
- package/package.json +1 -1
- package/src/components/index.js +0 -3
- package/src/components/picker/Picker.driver.new.d.ts +0 -32
- package/src/components/picker/Picker.driver.new.js +5 -7
- package/src/components/picker/helpers/useNewPickerProps.js +7 -11
- package/src/components/tabController/apis/tabController.api.json +5 -21
- package/src/components/textField/useImperativeInputHandle.js +0 -2
- package/src/components/timeline/Line.d.ts +0 -1
- package/src/components/timeline/Line.js +4 -5
- package/src/components/timeline/Point.d.ts +0 -1
- package/src/components/timeline/Point.js +4 -5
- package/src/components/timeline/index.js +5 -6
- package/src/components/wizard/wizard.api.json +7 -7
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -28
- package/src/testkit/index.d.ts +0 -2
- package/src/testkit/index.js +1 -3
- package/searchInput.d.ts +0 -2
- package/searchInput.js +0 -1
- package/src/components/chip/chip.driver.d.ts +0 -33
- package/src/components/chip/chip.driver.js +0 -56
- package/src/components/searchInput/index.d.ts +0 -37
- package/src/components/searchInput/index.js +0 -218
- package/src/components/searchInput/searchInput.api.json +0 -57
- package/src/components/searchInput/types.d.ts +0 -66
- package/src/components/searchInput/types.js +0 -5
- package/src/components/timeline/line.driver.d.ts +0 -10
- package/src/components/timeline/line.driver.js +0 -40
- package/src/components/timeline/point.driver.d.ts +0 -8
- package/src/components/timeline/point.driver.js +0 -55
- package/src/components/timeline/timeline.driver.d.ts +0 -25
- package/src/components/timeline/timeline.driver.js +0 -39
|
@@ -45,7 +45,7 @@ export default class TextInputKeyboardManager {
|
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
function findNodeHandle(ref) {
|
|
48
|
-
return
|
|
48
|
+
return ReactNative.findNodeHandle(ref.current || ref);
|
|
49
49
|
}
|
|
50
50
|
const springAnimation = {
|
|
51
51
|
duration: 400,
|
package/lib/package.json
CHANGED
package/package.json
CHANGED
package/src/components/index.js
CHANGED
|
@@ -137,9 +137,6 @@ export default {
|
|
|
137
137
|
get ProgressiveImage() {
|
|
138
138
|
return require('./progressiveImage').default;
|
|
139
139
|
},
|
|
140
|
-
get SearchInput() {
|
|
141
|
-
return require('./searchInput').default;
|
|
142
|
-
},
|
|
143
140
|
get StateScreen() {
|
|
144
141
|
return require('./stateScreen').default;
|
|
145
142
|
},
|
|
@@ -7,37 +7,5 @@ export declare const PickerDriver: (props: ComponentProps, useDialog: boolean) =
|
|
|
7
7
|
done: () => void;
|
|
8
8
|
isOpen: () => boolean;
|
|
9
9
|
dismissDialog: () => void;
|
|
10
|
-
itemDriver: (testID: string) => {
|
|
11
|
-
press: () => void;
|
|
12
|
-
hasOnPress: () => boolean;
|
|
13
|
-
onPressIn: () => void;
|
|
14
|
-
hasOnPressIn: () => boolean;
|
|
15
|
-
onPressOut: () => void;
|
|
16
|
-
hasOnPressOut: () => boolean;
|
|
17
|
-
onLongPress: () => void;
|
|
18
|
-
hasOnLongPress: () => boolean;
|
|
19
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
20
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
21
|
-
exists: () => boolean;
|
|
22
|
-
getStyle: () => any;
|
|
23
|
-
getLabel: () => {
|
|
24
|
-
getText: () => string | (string | import("react-test-renderer").ReactTestInstance)[];
|
|
25
|
-
getStyle: () => import("react-native/types").TextStyle;
|
|
26
|
-
press: () => void;
|
|
27
|
-
hasOnPress: () => boolean;
|
|
28
|
-
onPressIn: () => void;
|
|
29
|
-
hasOnPressIn: () => boolean;
|
|
30
|
-
onPressOut: () => void;
|
|
31
|
-
hasOnPressOut: () => boolean;
|
|
32
|
-
onLongPress: () => void;
|
|
33
|
-
hasOnLongPress: () => boolean;
|
|
34
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
35
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
36
|
-
exists: () => boolean;
|
|
37
|
-
};
|
|
38
|
-
getLabelStyle: () => import("react-native/types").TextStyle;
|
|
39
|
-
getIconStyle: () => any;
|
|
40
|
-
getIcon: () => import("../../testkit/new/Component.driver").ComponentDriverResult;
|
|
41
|
-
};
|
|
42
10
|
selectItem: (testID: string) => void;
|
|
43
11
|
};
|
|
@@ -54,13 +54,12 @@ export const PickerDriver = (props, useDialog) => {
|
|
|
54
54
|
dialogDriver.pressOnBackground();
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
const itemDriver = testID => ButtonDriver({
|
|
58
|
-
renderTree: props.renderTree,
|
|
59
|
-
testID
|
|
60
|
-
});
|
|
61
57
|
const selectItem = testID => {
|
|
62
|
-
const
|
|
63
|
-
|
|
58
|
+
const itemDriver = ButtonDriver({
|
|
59
|
+
renderTree: props.renderTree,
|
|
60
|
+
testID
|
|
61
|
+
});
|
|
62
|
+
itemDriver.press();
|
|
64
63
|
};
|
|
65
64
|
return {
|
|
66
65
|
exists,
|
|
@@ -70,7 +69,6 @@ export const PickerDriver = (props, useDialog) => {
|
|
|
70
69
|
done,
|
|
71
70
|
isOpen,
|
|
72
71
|
dismissDialog,
|
|
73
|
-
itemDriver,
|
|
74
72
|
selectItem
|
|
75
73
|
};
|
|
76
74
|
};
|
|
@@ -13,27 +13,23 @@ const useNewPickerProps = props => {
|
|
|
13
13
|
renderHeader,
|
|
14
14
|
renderOverlay
|
|
15
15
|
} = props;
|
|
16
|
-
const
|
|
16
|
+
const modalProps = {
|
|
17
17
|
animationType: 'slide',
|
|
18
18
|
transparent: Constants.isIOS && enableModalBlur,
|
|
19
19
|
enableModalBlur: Constants.isIOS && enableModalBlur,
|
|
20
20
|
onRequestClose: topBarProps?.onCancel
|
|
21
21
|
};
|
|
22
|
-
const mergedModalProps = {
|
|
23
|
-
...defaultModalProps,
|
|
24
|
-
...(onShow && {
|
|
25
|
-
onShow
|
|
26
|
-
}),
|
|
27
|
-
...pickerModalProps,
|
|
28
|
-
...customPickerProps?.modalProps
|
|
29
|
-
};
|
|
30
22
|
const newProps = {
|
|
31
23
|
renderHeader: renderCustomDialogHeader || renderHeader,
|
|
32
24
|
renderInput: renderPicker || renderInput,
|
|
33
25
|
renderOverlay: renderCustomModal || renderOverlay,
|
|
34
26
|
customPickerProps: {
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
modalProps: {
|
|
28
|
+
onShow,
|
|
29
|
+
...modalProps,
|
|
30
|
+
...pickerModalProps
|
|
31
|
+
},
|
|
32
|
+
...customPickerProps
|
|
37
33
|
}
|
|
38
34
|
};
|
|
39
35
|
return newProps;
|
|
@@ -5,17 +5,8 @@
|
|
|
5
5
|
"example": "https://github.com/wix/react-native-ui-lib/blob/master/demo/src/screens/componentScreens/TabControllerScreen/index.tsx",
|
|
6
6
|
"images": [],
|
|
7
7
|
"props": [
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
"type": "TabControllerItemProps[]",
|
|
11
|
-
"description": "The list of tab bar items"
|
|
12
|
-
},
|
|
13
|
-
{
|
|
14
|
-
"name": "initialIndex",
|
|
15
|
-
"type": "number",
|
|
16
|
-
"description": "Initial selected index",
|
|
17
|
-
"default": "0"
|
|
18
|
-
},
|
|
8
|
+
{"name": "items", "type": "TabControllerItemProps[]", "description": "The list of tab bar items"},
|
|
9
|
+
{"name": "initialIndex", "type": "number", "description": "Initial selected index", "default": "0"},
|
|
19
10
|
{
|
|
20
11
|
"name": "onChangeIndex",
|
|
21
12
|
"type": "(index: number, prevIndex: number | null) => void",
|
|
@@ -34,11 +25,7 @@
|
|
|
34
25
|
"note": "Does not work with asCarousel",
|
|
35
26
|
"default": "false"
|
|
36
27
|
},
|
|
37
|
-
{
|
|
38
|
-
"name": "carouselPageWidth;",
|
|
39
|
-
"type": "number",
|
|
40
|
-
"description": "Pass for custom carousel page width"
|
|
41
|
-
}
|
|
28
|
+
{"name": "carouselPageWidth;", "type": "number", "description": "Pass for custom carousel page width"}
|
|
42
29
|
],
|
|
43
30
|
"snippet": [
|
|
44
31
|
"<TabController items={[{label: 'First'}, {label: 'Second'}, {label: 'Third'}]$1}>",
|
|
@@ -88,7 +75,7 @@
|
|
|
88
75
|
"items": [
|
|
89
76
|
{
|
|
90
77
|
"title": "",
|
|
91
|
-
"description": "
|
|
78
|
+
"description": "**Inactive Tab**\nText: BodySmall $textDefault\nBackground: $backgroundElevated \n\n**Active Tab**\nText: BodySmallBold $textPrimary\nBackground: $backgroundElevated\nIndicator: $outlinePrimary \n\n**Shadow**\nsh10\n\n**Dark Skin**\nText: BodySmall, System White\nBackground: System Grey10\nDivider: System Grey20",
|
|
92
79
|
"content": [
|
|
93
80
|
{
|
|
94
81
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/TabBar/tabBar_overview_styling.png"
|
|
@@ -101,10 +88,7 @@
|
|
|
101
88
|
},
|
|
102
89
|
{
|
|
103
90
|
"type": "table",
|
|
104
|
-
"columns": [
|
|
105
|
-
"Property",
|
|
106
|
-
"Component"
|
|
107
|
-
],
|
|
91
|
+
"columns": ["Property", "Component"],
|
|
108
92
|
"items": [
|
|
109
93
|
{
|
|
110
94
|
"title": "Counter Badge",
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { useContext, useImperativeHandle, useRef } from 'react';
|
|
2
|
-
import { findNodeHandle } from 'react-native';
|
|
3
2
|
import FieldContext from "./FieldContext";
|
|
4
3
|
const useImperativeInputHandle = (ref, props) => {
|
|
5
4
|
const inputRef = useRef();
|
|
6
5
|
const context = useContext(FieldContext);
|
|
7
6
|
useImperativeHandle(ref, () => {
|
|
8
7
|
return {
|
|
9
|
-
getNodeHandle: () => inputRef.current ? findNodeHandle(inputRef.current) : null,
|
|
10
8
|
isFocused: () => inputRef.current?.isFocused(),
|
|
11
9
|
focus: () => inputRef.current?.focus(),
|
|
12
10
|
blur: () => inputRef.current?.blur(),
|
|
@@ -12,8 +12,7 @@ const Line = React.memo(props => {
|
|
|
12
12
|
entry,
|
|
13
13
|
top,
|
|
14
14
|
style,
|
|
15
|
-
width = LINE_WIDTH
|
|
16
|
-
testID
|
|
15
|
+
width = LINE_WIDTH
|
|
17
16
|
} = props;
|
|
18
17
|
const solidLineStyle = useMemo(() => {
|
|
19
18
|
return [style, styles.line, {
|
|
@@ -28,14 +27,14 @@ const Line = React.memo(props => {
|
|
|
28
27
|
if (entry) {
|
|
29
28
|
return <View style={[styles.entryPoint, {
|
|
30
29
|
backgroundColor: color
|
|
31
|
-
}]}
|
|
30
|
+
}]} />;
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
33
|
const renderLine = () => {
|
|
35
34
|
if (type === LineTypes.DASHED) {
|
|
36
|
-
return <Dash vertical color={color} containerStyle={dashedLineStyle}
|
|
35
|
+
return <Dash vertical color={color} containerStyle={dashedLineStyle} />;
|
|
37
36
|
}
|
|
38
|
-
return <View style={solidLineStyle}
|
|
37
|
+
return <View style={solidLineStyle} />;
|
|
39
38
|
};
|
|
40
39
|
return <>
|
|
41
40
|
{top && renderStartPoint()}
|
|
@@ -3,7 +3,6 @@ import { LayoutChangeEvent } from 'react-native';
|
|
|
3
3
|
import { PointProps } from './types';
|
|
4
4
|
type PointPropsInternal = PointProps & {
|
|
5
5
|
onLayout?: (event: LayoutChangeEvent) => void;
|
|
6
|
-
testID?: string;
|
|
7
6
|
};
|
|
8
7
|
declare const Point: (props: PointPropsInternal) => React.JSX.Element;
|
|
9
8
|
export default Point;
|
|
@@ -20,8 +20,7 @@ const Point = props => {
|
|
|
20
20
|
label,
|
|
21
21
|
type,
|
|
22
22
|
color,
|
|
23
|
-
onLayout
|
|
24
|
-
testID
|
|
23
|
+
onLayout
|
|
25
24
|
} = props;
|
|
26
25
|
const pointStyle = useMemo(() => {
|
|
27
26
|
const hasOutline = type === PointTypes.OUTLINE;
|
|
@@ -56,14 +55,14 @@ const Point = props => {
|
|
|
56
55
|
const tintColor = removeIconBackground ? Colors.$iconDefault : Colors.$iconDefaultLight;
|
|
57
56
|
const iconSize = removeIconBackground ? undefined : ICON_SIZE;
|
|
58
57
|
if (icon) {
|
|
59
|
-
return <Icon
|
|
58
|
+
return <Icon tintColor={tintColor} {...iconProps} size={iconSize} source={icon} />;
|
|
60
59
|
} else if (label) {
|
|
61
|
-
return <Text
|
|
60
|
+
return <Text recorderTag={'unmask'} $textDefaultLight subtextBold color={labelColor}>
|
|
62
61
|
{label}
|
|
63
62
|
</Text>;
|
|
64
63
|
}
|
|
65
64
|
};
|
|
66
|
-
return <View center style={pointStyle} onLayout={onLayout}
|
|
65
|
+
return <View center style={pointStyle} onLayout={onLayout}>
|
|
67
66
|
{renderPointContent()}
|
|
68
67
|
</View>;
|
|
69
68
|
};
|
|
@@ -15,8 +15,7 @@ const Timeline = props => {
|
|
|
15
15
|
topLine,
|
|
16
16
|
bottomLine,
|
|
17
17
|
point,
|
|
18
|
-
children
|
|
19
|
-
testID
|
|
18
|
+
children
|
|
20
19
|
} = themeProps;
|
|
21
20
|
const [anchorMeasurements, setAnchorMeasurements] = useState();
|
|
22
21
|
const [contentContainerMeasurements, setContentContainerMeasurements] = useState();
|
|
@@ -108,17 +107,17 @@ const Timeline = props => {
|
|
|
108
107
|
});
|
|
109
108
|
}, []);
|
|
110
109
|
const renderTopLine = () => {
|
|
111
|
-
return <Line
|
|
110
|
+
return <Line {...topLine} top style={topLineStyle} color={topLine ? topLine?.color || getStateColor(topLine?.state) : undefined} />;
|
|
112
111
|
};
|
|
113
112
|
const renderBottomLine = () => {
|
|
114
113
|
if (bottomLine) {
|
|
115
|
-
return <Line
|
|
114
|
+
return <Line {...bottomLine} style={styles.bottomLine} color={bottomLine?.color || getStateColor(bottomLine?.state)} />;
|
|
116
115
|
}
|
|
117
116
|
};
|
|
118
|
-
return <View row style={containerStyle}
|
|
117
|
+
return <View row style={containerStyle}>
|
|
119
118
|
<View style={styles.timelineContainer}>
|
|
120
119
|
{renderTopLine()}
|
|
121
|
-
<Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)}
|
|
120
|
+
<Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)} />
|
|
122
121
|
{renderBottomLine()}
|
|
123
122
|
</View>
|
|
124
123
|
<View style={styles.contentContainer} onLayout={onContentContainerLayout} ref={contentContainerRef}>
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
],
|
|
130
130
|
"items": [
|
|
131
131
|
{
|
|
132
|
-
"title": "Active",
|
|
132
|
+
"title": "**Active**",
|
|
133
133
|
"description": "Border: $outlinePrimary \nNumber: subtext, $textPrimary \nStep label: bodySmallBold, $textNuetralHeavy ",
|
|
134
134
|
"content": [
|
|
135
135
|
{
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
]
|
|
139
139
|
},
|
|
140
140
|
{
|
|
141
|
-
"title": "Next (enabled)",
|
|
141
|
+
"title": "**Next (enabled)**",
|
|
142
142
|
"description": "Border: $outlineDisabled \nNumber: subtext, $textNuetralHeavy ",
|
|
143
143
|
"content": [
|
|
144
144
|
{
|
|
@@ -147,7 +147,7 @@
|
|
|
147
147
|
]
|
|
148
148
|
},
|
|
149
149
|
{
|
|
150
|
-
"title": "Next (disabled)",
|
|
150
|
+
"title": "**Next (disabled)** ",
|
|
151
151
|
"description": "Border: $outlineDisabled \nNumber: subtext, $textDisabled ",
|
|
152
152
|
"content": [
|
|
153
153
|
{
|
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
]
|
|
157
157
|
},
|
|
158
158
|
{
|
|
159
|
-
"title": "Completed",
|
|
159
|
+
"title": "**Completed** ",
|
|
160
160
|
"description": "Border: $outlineDisabled \nIcon: $iconNuetral ",
|
|
161
161
|
"content": [
|
|
162
162
|
{
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
]
|
|
166
166
|
},
|
|
167
167
|
{
|
|
168
|
-
"title": "Skipped",
|
|
168
|
+
"title": "**Skipped** ",
|
|
169
169
|
"description": "Border: $outlineDanger \nNumber: subtext, $textDangerLight ",
|
|
170
170
|
"content": [
|
|
171
171
|
{
|
|
@@ -174,7 +174,7 @@
|
|
|
174
174
|
]
|
|
175
175
|
},
|
|
176
176
|
{
|
|
177
|
-
"title": "Error",
|
|
177
|
+
"title": "**Error** ",
|
|
178
178
|
"description": "Border: $outlineDanger \nIcon: $iconDangerLight",
|
|
179
179
|
"content": [
|
|
180
180
|
{
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
"value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components Docs/Wizard/wizard_overview_section_spec.png"
|
|
193
193
|
}
|
|
194
194
|
],
|
|
195
|
-
"description": "
|
|
195
|
+
"description": "**Spacing Between Steps** \nAll steps are distributed evenly, leaving S5 margins. \nMin spacing between steps: S3 \n\n**Maximum Step Width** \nCurrent step’s text box shouldnt be larger than 40% of the screen’s width. \nIf the label will be larger it will get ellipsis. \ne.g. : For 375px screen : 40% = 150px"
|
|
196
196
|
},
|
|
197
197
|
{
|
|
198
198
|
"type": "section",
|
package/src/index.d.ts
CHANGED
|
@@ -76,7 +76,6 @@ export { default as RadioGroup, RadioGroupProps } from './components/radioGroup'
|
|
|
76
76
|
export type { RecorderProps } from './typings/recorderTypes';
|
|
77
77
|
export type { ComponentStatics } from './typings/common';
|
|
78
78
|
export { default as ScrollBar, ScrollBarProps } from './components/scrollBar';
|
|
79
|
-
export { default as SearchInput, SearchInputProps, SearchInputRef } from './components/searchInput';
|
|
80
79
|
export { default as SectionsWheelPicker, SectionsWheelPickerProps } from './components/sectionsWheelPicker';
|
|
81
80
|
export { default as SegmentedControl, SegmentedControlProps, SegmentedControlItemProps, SegmentedControlPreset } from './components/segmentedControl';
|
|
82
81
|
export { default as SharedTransition } from './components/sharedTransition';
|
package/src/index.js
CHANGED
|
@@ -179,9 +179,6 @@ var _exportNames = {
|
|
|
179
179
|
RadioGroupProps: true,
|
|
180
180
|
ScrollBar: true,
|
|
181
181
|
ScrollBarProps: true,
|
|
182
|
-
SearchInput: true,
|
|
183
|
-
SearchInputProps: true,
|
|
184
|
-
SearchInputRef: true,
|
|
185
182
|
SectionsWheelPicker: true,
|
|
186
183
|
SectionsWheelPickerProps: true,
|
|
187
184
|
SegmentedControl: true,
|
|
@@ -1216,24 +1213,6 @@ Object.defineProperty(exports, "ScrollBarProps", {
|
|
|
1216
1213
|
return _scrollBar().ScrollBarProps;
|
|
1217
1214
|
}
|
|
1218
1215
|
});
|
|
1219
|
-
Object.defineProperty(exports, "SearchInput", {
|
|
1220
|
-
enumerable: true,
|
|
1221
|
-
get: function () {
|
|
1222
|
-
return _searchInput().default;
|
|
1223
|
-
}
|
|
1224
|
-
});
|
|
1225
|
-
Object.defineProperty(exports, "SearchInputProps", {
|
|
1226
|
-
enumerable: true,
|
|
1227
|
-
get: function () {
|
|
1228
|
-
return _searchInput().SearchInputProps;
|
|
1229
|
-
}
|
|
1230
|
-
});
|
|
1231
|
-
Object.defineProperty(exports, "SearchInputRef", {
|
|
1232
|
-
enumerable: true,
|
|
1233
|
-
get: function () {
|
|
1234
|
-
return _searchInput().SearchInputRef;
|
|
1235
|
-
}
|
|
1236
|
-
});
|
|
1237
1216
|
Object.defineProperty(exports, "SectionsWheelPicker", {
|
|
1238
1217
|
enumerable: true,
|
|
1239
1218
|
get: function () {
|
|
@@ -2221,13 +2200,6 @@ function _scrollBar() {
|
|
|
2221
2200
|
};
|
|
2222
2201
|
return data;
|
|
2223
2202
|
}
|
|
2224
|
-
function _searchInput() {
|
|
2225
|
-
const data = _interopRequireWildcard(require("./components/searchInput"));
|
|
2226
|
-
_searchInput = function () {
|
|
2227
|
-
return data;
|
|
2228
|
-
};
|
|
2229
|
-
return data;
|
|
2230
|
-
}
|
|
2231
2203
|
function _sectionsWheelPicker() {
|
|
2232
2204
|
const data = _interopRequireWildcard(require("./components/sectionsWheelPicker"));
|
|
2233
2205
|
_sectionsWheelPicker = function () {
|
package/src/testkit/index.d.ts
CHANGED
|
@@ -21,5 +21,3 @@ export { PickerDriver } from '../components/picker/Picker.driver.new';
|
|
|
21
21
|
export { ExpandableOverlayDriver } from '../incubator/expandableOverlay/ExpandableOverlay.driver';
|
|
22
22
|
export { ToastDriver } from '../incubator/toast/Toast.driver.new';
|
|
23
23
|
export { DateTimePickerDriver } from '../components/dateTimePicker/DateTimePicker.driver';
|
|
24
|
-
export { TimelineDriver } from '../components/timeline/timeline.driver';
|
|
25
|
-
export { ChipDriver } from '../components/chip/chip.driver';
|
package/src/testkit/index.js
CHANGED
|
@@ -20,6 +20,4 @@ export { WheelPickerItemDriver } from "../components/WheelPicker/WheelPickerItem
|
|
|
20
20
|
export { PickerDriver } from "../components/picker/Picker.driver.new";
|
|
21
21
|
export { ExpandableOverlayDriver } from "../incubator/expandableOverlay/ExpandableOverlay.driver";
|
|
22
22
|
export { ToastDriver } from "../incubator/toast/Toast.driver.new";
|
|
23
|
-
export { DateTimePickerDriver } from "../components/dateTimePicker/DateTimePicker.driver";
|
|
24
|
-
export { TimelineDriver } from "../components/timeline/timeline.driver";
|
|
25
|
-
export { ChipDriver } from "../components/chip/chip.driver";
|
|
23
|
+
export { DateTimePickerDriver } from "../components/dateTimePicker/DateTimePicker.driver";
|
package/searchInput.d.ts
DELETED
package/searchInput.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./src/components/searchInput').default;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
-
export declare const ChipDriver: (props: ComponentProps) => {
|
|
3
|
-
getLabel: () => {
|
|
4
|
-
getText: () => string | (string | import("react-test-renderer").ReactTestInstance)[];
|
|
5
|
-
getStyle: () => import("react-native").TextStyle;
|
|
6
|
-
press: () => void;
|
|
7
|
-
hasOnPress: () => boolean;
|
|
8
|
-
onPressIn: () => void;
|
|
9
|
-
hasOnPressIn: () => boolean;
|
|
10
|
-
onPressOut: () => void;
|
|
11
|
-
hasOnPressOut: () => boolean;
|
|
12
|
-
onLongPress: () => void;
|
|
13
|
-
hasOnLongPress: () => boolean;
|
|
14
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
15
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
16
|
-
exists: () => boolean;
|
|
17
|
-
};
|
|
18
|
-
getDismissIcon: () => {
|
|
19
|
-
exists: () => boolean;
|
|
20
|
-
getStyle: () => any;
|
|
21
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
22
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
23
|
-
};
|
|
24
|
-
getIcon: () => {
|
|
25
|
-
exists: () => boolean;
|
|
26
|
-
getStyle: () => any;
|
|
27
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
28
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
29
|
-
};
|
|
30
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
31
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
32
|
-
exists: () => boolean;
|
|
33
|
-
};
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { useComponentDriver } from "../../testkit/new/Component.driver";
|
|
3
|
-
import { TextDriver } from "../text/Text.driver.new";
|
|
4
|
-
import { ImageDriver } from "../image/Image.driver.new";
|
|
5
|
-
export const ChipDriver = props => {
|
|
6
|
-
const driver = useComponentDriver(props);
|
|
7
|
-
const labelDriver = TextDriver({
|
|
8
|
-
renderTree: props.renderTree,
|
|
9
|
-
testID: `${props.testID}.label`
|
|
10
|
-
});
|
|
11
|
-
const dismissIconDriver = ImageDriver({
|
|
12
|
-
renderTree: props.renderTree,
|
|
13
|
-
testID: `${props.testID}.dismissIcon`
|
|
14
|
-
});
|
|
15
|
-
const iconDriver = ImageDriver({
|
|
16
|
-
renderTree: props.renderTree,
|
|
17
|
-
testID: `${props.testID}.icon`
|
|
18
|
-
});
|
|
19
|
-
const getLabel = () => {
|
|
20
|
-
return {
|
|
21
|
-
...labelDriver
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
const getDismissIcon = () => {
|
|
25
|
-
const exists = () => {
|
|
26
|
-
return dismissIconDriver.exists();
|
|
27
|
-
};
|
|
28
|
-
const getStyle = () => {
|
|
29
|
-
return StyleSheet.flatten(dismissIconDriver.getElement().props.style);
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
...dismissIconDriver,
|
|
33
|
-
exists,
|
|
34
|
-
getStyle
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
const getIcon = () => {
|
|
38
|
-
const exists = () => {
|
|
39
|
-
return iconDriver.exists();
|
|
40
|
-
};
|
|
41
|
-
const getStyle = () => {
|
|
42
|
-
return StyleSheet.flatten(iconDriver.getElement().props.style);
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
...iconDriver,
|
|
46
|
-
exists,
|
|
47
|
-
getStyle
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
|
-
return {
|
|
51
|
-
...driver,
|
|
52
|
-
getLabel,
|
|
53
|
-
getDismissIcon,
|
|
54
|
-
getIcon
|
|
55
|
-
};
|
|
56
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { SearchInputPresets, SearchInputProps, SearchInputRef } from './types';
|
|
3
|
-
declare const SearchInput: React.ForwardRefExoticComponent<import("react-native").TextInputProps & {
|
|
4
|
-
onClear?: (() => void) | undefined;
|
|
5
|
-
onDismiss?: (() => void) | undefined;
|
|
6
|
-
cancelButtonProps?: import("../button").ButtonProps | undefined;
|
|
7
|
-
customRightElement?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
8
|
-
showLoader?: boolean | undefined;
|
|
9
|
-
loaderProps?: import("react-native").ActivityIndicatorProps | undefined;
|
|
10
|
-
customLoader?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
11
|
-
invertColors?: boolean | undefined;
|
|
12
|
-
inaccessible?: boolean | undefined;
|
|
13
|
-
useSafeArea?: boolean | undefined;
|
|
14
|
-
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
15
|
-
containerStyle?: import("react-native").StyleProp<import("react-native").TextStyle | import("react-native").ViewStyle>;
|
|
16
|
-
preset?: "default" | "prominent" | SearchInputPresets | undefined;
|
|
17
|
-
} & React.RefAttributes<any>>;
|
|
18
|
-
interface StaticMembers {
|
|
19
|
-
presets: typeof SearchInputPresets;
|
|
20
|
-
}
|
|
21
|
-
export { SearchInput, SearchInputProps, SearchInputRef, SearchInputPresets };
|
|
22
|
-
declare const _default: React.ForwardRefExoticComponent<import("react-native").TextInputProps & {
|
|
23
|
-
onClear?: (() => void) | undefined;
|
|
24
|
-
onDismiss?: (() => void) | undefined;
|
|
25
|
-
cancelButtonProps?: import("../button").ButtonProps | undefined;
|
|
26
|
-
customRightElement?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
27
|
-
showLoader?: boolean | undefined;
|
|
28
|
-
loaderProps?: import("react-native").ActivityIndicatorProps | undefined;
|
|
29
|
-
customLoader?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
30
|
-
invertColors?: boolean | undefined;
|
|
31
|
-
inaccessible?: boolean | undefined;
|
|
32
|
-
useSafeArea?: boolean | undefined;
|
|
33
|
-
style?: import("react-native").StyleProp<import("react-native").ViewStyle>;
|
|
34
|
-
containerStyle?: import("react-native").StyleProp<import("react-native").TextStyle | import("react-native").ViewStyle>;
|
|
35
|
-
preset?: "default" | "prominent" | SearchInputPresets | undefined;
|
|
36
|
-
} & React.RefAttributes<any>> & StaticMembers;
|
|
37
|
-
export default _default;
|
|
@@ -1,218 +0,0 @@
|
|
|
1
|
-
import _isEmpty from "lodash/isEmpty";
|
|
2
|
-
import React, { useImperativeHandle, forwardRef, useEffect, useRef, useState } from 'react';
|
|
3
|
-
import { StyleSheet, Animated, TextInput, ActivityIndicator } from 'react-native';
|
|
4
|
-
import { SearchInputPresets, SearchInputProps, SearchInputRef } from "./types";
|
|
5
|
-
import { Colors, BorderRadiuses, Spacings, Typography } from "../../style";
|
|
6
|
-
import { Constants, asBaseComponent } from "../../commons/new";
|
|
7
|
-
import Button from "../button";
|
|
8
|
-
import Icon from "../icon";
|
|
9
|
-
import View from "../view";
|
|
10
|
-
import Assets from "../../assets";
|
|
11
|
-
const ICON_SIZE = 24;
|
|
12
|
-
const INPUT_HEIGHT = 60;
|
|
13
|
-
const TOP_INPUT_HEIGHT = Constants.isIOS ? 40 : 56;
|
|
14
|
-
const PROMINENT_INPUT_HEIGHT = 48;
|
|
15
|
-
const INVERTED_TEXT_COLOR = Colors.$textDefaultLight;
|
|
16
|
-
const INVERTED_ICON_COLOR = Colors.$iconDefaultLight;
|
|
17
|
-
const HIT_SLOP_VALUE = 20;
|
|
18
|
-
const SearchInput = forwardRef((props, ref) => {
|
|
19
|
-
const {
|
|
20
|
-
preset = SearchInputPresets.DEFAULT,
|
|
21
|
-
onDismiss,
|
|
22
|
-
useSafeArea,
|
|
23
|
-
invertColors,
|
|
24
|
-
testID,
|
|
25
|
-
showLoader,
|
|
26
|
-
loaderProps,
|
|
27
|
-
value: controlledValue,
|
|
28
|
-
onChangeText,
|
|
29
|
-
onClear,
|
|
30
|
-
containerStyle,
|
|
31
|
-
customRightElement,
|
|
32
|
-
style,
|
|
33
|
-
inaccessible
|
|
34
|
-
} = props;
|
|
35
|
-
const currentAnimatedValue = useRef();
|
|
36
|
-
const searchInputRef = useRef(null);
|
|
37
|
-
const [hasValue, setHasValue] = useState(Boolean(controlledValue));
|
|
38
|
-
const [value, setValue] = useState(controlledValue);
|
|
39
|
-
const [valueState] = useState(new Animated.Value(_isEmpty(controlledValue) ? 0 : 1));
|
|
40
|
-
const [isAnimatingClearButton, setIsAnimatingClearButton] = useState(!_isEmpty(controlledValue));
|
|
41
|
-
useImperativeHandle(ref, () => {
|
|
42
|
-
return {
|
|
43
|
-
blur: () => searchInputRef.current?.blur(),
|
|
44
|
-
focus: () => searchInputRef.current?.focus(),
|
|
45
|
-
clear: () => {
|
|
46
|
-
searchInputRef.current?.clear();
|
|
47
|
-
onChangeText?.('');
|
|
48
|
-
onClear?.();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
});
|
|
52
|
-
useEffect(() => {
|
|
53
|
-
if (controlledValue !== value) {
|
|
54
|
-
setValue(controlledValue);
|
|
55
|
-
setHasValue(Boolean(controlledValue));
|
|
56
|
-
}
|
|
57
|
-
}, [controlledValue]);
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
if (hasValue) {
|
|
60
|
-
animatedValueState(1);
|
|
61
|
-
} else {
|
|
62
|
-
animatedValueState(0);
|
|
63
|
-
}
|
|
64
|
-
}, [hasValue]);
|
|
65
|
-
useEffect(() => {
|
|
66
|
-
return () => {
|
|
67
|
-
currentAnimatedValue.current?.stop();
|
|
68
|
-
};
|
|
69
|
-
}, []);
|
|
70
|
-
const animatedValueState = value => {
|
|
71
|
-
setIsAnimatingClearButton(true);
|
|
72
|
-
if (currentAnimatedValue.current) {
|
|
73
|
-
currentAnimatedValue.current.stop();
|
|
74
|
-
}
|
|
75
|
-
currentAnimatedValue.current = Animated.timing(valueState, {
|
|
76
|
-
toValue: value,
|
|
77
|
-
duration: 160,
|
|
78
|
-
useNativeDriver: true
|
|
79
|
-
});
|
|
80
|
-
currentAnimatedValue.current.start(() => {
|
|
81
|
-
if (!hasValue) {
|
|
82
|
-
setIsAnimatingClearButton(false);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
const getHeight = () => {
|
|
87
|
-
const isProminent = preset === SearchInputPresets.PROMINENT;
|
|
88
|
-
if (isProminent) {
|
|
89
|
-
return PROMINENT_INPUT_HEIGHT;
|
|
90
|
-
}
|
|
91
|
-
return useSafeArea ? TOP_INPUT_HEIGHT : INPUT_HEIGHT;
|
|
92
|
-
};
|
|
93
|
-
const onChangeTextHandler = text => {
|
|
94
|
-
console.log(`onChangeTextHandler, text:`, text);
|
|
95
|
-
onChangeText?.(text);
|
|
96
|
-
setValue(text);
|
|
97
|
-
setHasValue(!_isEmpty(text));
|
|
98
|
-
};
|
|
99
|
-
const clearInput = () => {
|
|
100
|
-
searchInputRef?.current?.clear();
|
|
101
|
-
onChangeTextHandler('');
|
|
102
|
-
onClear?.();
|
|
103
|
-
};
|
|
104
|
-
const renderClearButton = () => {
|
|
105
|
-
const transform = [{
|
|
106
|
-
translateY: valueState.interpolate({
|
|
107
|
-
inputRange: [0, 1],
|
|
108
|
-
outputRange: [50, 1]
|
|
109
|
-
})
|
|
110
|
-
}];
|
|
111
|
-
const clearButtonStyle = !isDismissible() && isAnimatingClearButton && styles.clearButton;
|
|
112
|
-
const iconStyle = {
|
|
113
|
-
tintColor: invertColors ? INVERTED_ICON_COLOR : Colors.grey40,
|
|
114
|
-
width: 12,
|
|
115
|
-
height: 12
|
|
116
|
-
};
|
|
117
|
-
return <Animated.View style={[{
|
|
118
|
-
transform
|
|
119
|
-
}, clearButtonStyle]}>
|
|
120
|
-
<Button link grey10 text80 iconSource={Assets.internal.icons.x} iconStyle={iconStyle} onPress={clearInput} hitSlop={HIT_SLOP_VALUE} accessible={Boolean(hasValue)} accessibilityLabel={'clear'} testID={`${testID}.clearButton`} />
|
|
121
|
-
</Animated.View>;
|
|
122
|
-
};
|
|
123
|
-
const renderCancelButton = () => {
|
|
124
|
-
const {
|
|
125
|
-
cancelButtonProps
|
|
126
|
-
} = props;
|
|
127
|
-
if (onDismiss) {
|
|
128
|
-
return <Button style={styles.cancelButton} link color={invertColors ? INVERTED_TEXT_COLOR : undefined} $textDefault text65M {...cancelButtonProps} onPress={onDismiss} testID={`${testID}.cancelButton`} />;
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
const renderTextInput = () => {
|
|
132
|
-
const {
|
|
133
|
-
placeholder
|
|
134
|
-
} = props;
|
|
135
|
-
const height = getHeight();
|
|
136
|
-
const placeholderTextColor = invertColors ? INVERTED_TEXT_COLOR : Colors.$textDefault;
|
|
137
|
-
const selectionColor = invertColors ? INVERTED_TEXT_COLOR : Colors.$textDefault;
|
|
138
|
-
return <View style={[styles.inputContainer, {
|
|
139
|
-
height
|
|
140
|
-
}]}>
|
|
141
|
-
<TextInput accessibilityRole={'search'} placeholder={placeholder} placeholderTextColor={placeholderTextColor} underlineColorAndroid="transparent" selectionColor={selectionColor} ref={searchInputRef} value={value} allowFontScaling={false} style={[styles.input, containerStyle, invertColors && {
|
|
142
|
-
color: INVERTED_TEXT_COLOR
|
|
143
|
-
}, (!isDismissible() || isAnimatingClearButton) && styles.emptyInput]} onChangeText={onChangeTextHandler} testID={testID} />
|
|
144
|
-
{isAnimatingClearButton && renderClearButton()}
|
|
145
|
-
{isDismissible() && renderCancelButton()}
|
|
146
|
-
{!isDismissible() && customRightElement}
|
|
147
|
-
</View>;
|
|
148
|
-
};
|
|
149
|
-
const isDismissible = () => {
|
|
150
|
-
return typeof onDismiss !== 'undefined';
|
|
151
|
-
};
|
|
152
|
-
const renderIcon = (icon, left = true) => {
|
|
153
|
-
const invertedColor = invertColors ? {
|
|
154
|
-
tintColor: INVERTED_ICON_COLOR
|
|
155
|
-
} : undefined;
|
|
156
|
-
return <View>
|
|
157
|
-
<Icon tintColor={invertedColor?.tintColor} style={[styles.icon, invertedColor, left && styles.leftIcon]} source={icon} size={ICON_SIZE} />
|
|
158
|
-
</View>;
|
|
159
|
-
};
|
|
160
|
-
const renderLoader = () => {
|
|
161
|
-
const {
|
|
162
|
-
customLoader
|
|
163
|
-
} = props;
|
|
164
|
-
return <View>{customLoader ? customLoader : <ActivityIndicator style={styles.loader} {...loaderProps} />}</View>;
|
|
165
|
-
};
|
|
166
|
-
const topInputTopMargin = useSafeArea && {
|
|
167
|
-
marginTop: Constants.isIOS ? Constants.statusBarHeight : 0
|
|
168
|
-
};
|
|
169
|
-
const isProminent = preset === SearchInputPresets.PROMINENT;
|
|
170
|
-
return <View inaccessible={inaccessible} row centerV style={[style, isProminent && styles.prominentContainer, topInputTopMargin]} testID={`${testID}.searchBox`}>
|
|
171
|
-
{showLoader ? renderLoader() : renderIcon(Assets.internal.icons.search)}
|
|
172
|
-
{renderTextInput()}
|
|
173
|
-
</View>;
|
|
174
|
-
});
|
|
175
|
-
const styles = StyleSheet.create({
|
|
176
|
-
inputContainer: {
|
|
177
|
-
height: INPUT_HEIGHT,
|
|
178
|
-
flex: 1,
|
|
179
|
-
flexDirection: 'row',
|
|
180
|
-
alignItems: 'center',
|
|
181
|
-
overflow: 'hidden'
|
|
182
|
-
},
|
|
183
|
-
prominentContainer: {
|
|
184
|
-
borderWidth: 1,
|
|
185
|
-
borderColor: Colors.$outlineDefault,
|
|
186
|
-
borderRadius: BorderRadiuses.br20,
|
|
187
|
-
marginHorizontal: Spacings.s5
|
|
188
|
-
},
|
|
189
|
-
input: {
|
|
190
|
-
flex: 1,
|
|
191
|
-
...Typography.body,
|
|
192
|
-
lineHeight: undefined,
|
|
193
|
-
color: Colors.$textDefault,
|
|
194
|
-
textAlign: Constants.isRTL ? 'right' : 'left'
|
|
195
|
-
},
|
|
196
|
-
emptyInput: {
|
|
197
|
-
marginRight: Spacings.s4
|
|
198
|
-
},
|
|
199
|
-
cancelButton: {
|
|
200
|
-
marginLeft: Spacings.s4,
|
|
201
|
-
marginRight: Spacings.s4
|
|
202
|
-
},
|
|
203
|
-
clearButton: {
|
|
204
|
-
marginRight: Spacings.s4
|
|
205
|
-
},
|
|
206
|
-
icon: {
|
|
207
|
-
marginRight: Spacings.s4
|
|
208
|
-
},
|
|
209
|
-
leftIcon: {
|
|
210
|
-
marginLeft: Spacings.s4
|
|
211
|
-
},
|
|
212
|
-
loader: {
|
|
213
|
-
marginHorizontal: Spacings.s4
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
SearchInput.displayName = 'SearchInput';
|
|
217
|
-
export { SearchInput, SearchInputProps, SearchInputRef, SearchInputPresets };
|
|
218
|
-
export default asBaseComponent(SearchInput);
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "SearchInput",
|
|
3
|
-
"category": "form",
|
|
4
|
-
"description": "Search input for filtering purpose",
|
|
5
|
-
"example": "https://github.com/wix-private/wix-react-native-ui-lib/blob/master/example/screens/components/SearchInputScreen.tsx",
|
|
6
|
-
"extends": ["TextInput"],
|
|
7
|
-
"extendsLink": "https://reactnative.dev/docs/textinput",
|
|
8
|
-
"props": [
|
|
9
|
-
{"name": "onDismiss", "type": "() => void", "description": "callback for dismiss action"},
|
|
10
|
-
{"name": "onClear", "type": "() => void", "description": "On clear button callback."},
|
|
11
|
-
{
|
|
12
|
-
"name": "showLoader",
|
|
13
|
-
"type": "boolean",
|
|
14
|
-
"description": "Whether to show a loader instead of the left search icon."
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"name": "customLoader",
|
|
18
|
-
"type": "React.ReactElement",
|
|
19
|
-
"description": "custom loader element to render instead of the default loader"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
"name": "customRightElement",
|
|
23
|
-
"type": "React.ReactElement",
|
|
24
|
-
"description": "Custom right element"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
"name": "cancelButtonProps",
|
|
28
|
-
"type": "ButtonProps",
|
|
29
|
-
"description": "Props for the cancel button"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"name": "schemeColor",
|
|
33
|
-
"type": "string | null",
|
|
34
|
-
"description": "The SearchInput colors (affects the search icon color and the cancel button color)"
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
"name": "inaccessible",
|
|
38
|
-
"type": "boolean",
|
|
39
|
-
"description": "Turn off accessibility for this view and its nested children"
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"name": "useSafeArea",
|
|
43
|
-
"type": "boolean",
|
|
44
|
-
"description": "in case the SearchInput is rendered in a safe area (top of the screen)"
|
|
45
|
-
},
|
|
46
|
-
{"name": "containerStyle", "type": "ViewStyle", "description": "Override styles for the input"},
|
|
47
|
-
{"name": "style", "type": "ViewStyle", "description": "Override styles for container"}
|
|
48
|
-
],
|
|
49
|
-
"snippet": [
|
|
50
|
-
"<SearchInput",
|
|
51
|
-
" ref={searchInputRef$1}",
|
|
52
|
-
" testID={'searchInput'$2}",
|
|
53
|
-
" placeholder={'Search'$3}",
|
|
54
|
-
" onDismiss={onDismiss$4}",
|
|
55
|
-
"/>"
|
|
56
|
-
]
|
|
57
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { TextInputProps, StyleProp, ViewStyle, TextStyle, ActivityIndicatorProps } from 'react-native';
|
|
3
|
-
import { ButtonProps } from '../button';
|
|
4
|
-
export declare enum SearchInputPresets {
|
|
5
|
-
DEFAULT = "default",
|
|
6
|
-
PROMINENT = "prominent"
|
|
7
|
-
}
|
|
8
|
-
export interface SearchInputRef {
|
|
9
|
-
blur: () => void;
|
|
10
|
-
clear: () => void;
|
|
11
|
-
focus: () => void;
|
|
12
|
-
}
|
|
13
|
-
export type SearchInputProps = TextInputProps & {
|
|
14
|
-
/**
|
|
15
|
-
* On clear button callback.
|
|
16
|
-
*/
|
|
17
|
-
onClear?: () => void;
|
|
18
|
-
/**
|
|
19
|
-
* callback for dismiss action
|
|
20
|
-
*/
|
|
21
|
-
onDismiss?: () => void;
|
|
22
|
-
/**
|
|
23
|
-
* Props for the cancel button
|
|
24
|
-
*/
|
|
25
|
-
cancelButtonProps?: ButtonProps;
|
|
26
|
-
/**
|
|
27
|
-
* Custom right element
|
|
28
|
-
*/
|
|
29
|
-
customRightElement?: React.ReactElement;
|
|
30
|
-
/**
|
|
31
|
-
* Whether to show a loader instead of the left search icon
|
|
32
|
-
*/
|
|
33
|
-
showLoader?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* Loader props
|
|
36
|
-
*/
|
|
37
|
-
loaderProps?: ActivityIndicatorProps;
|
|
38
|
-
/**
|
|
39
|
-
* custom loader element
|
|
40
|
-
*/
|
|
41
|
-
customLoader?: React.ReactElement;
|
|
42
|
-
/**
|
|
43
|
-
* converts the colors of the search's input elements, icons and button to white
|
|
44
|
-
*/
|
|
45
|
-
invertColors?: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* Turn off accessibility for this view and its nested children
|
|
48
|
-
*/
|
|
49
|
-
inaccessible?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* in case the SearchInput is rendered in a safe area (top of the screen)
|
|
52
|
-
*/
|
|
53
|
-
useSafeArea?: boolean;
|
|
54
|
-
/**
|
|
55
|
-
* Override styles for container
|
|
56
|
-
*/
|
|
57
|
-
style?: StyleProp<ViewStyle>;
|
|
58
|
-
/**
|
|
59
|
-
* Override styles for the input
|
|
60
|
-
*/
|
|
61
|
-
containerStyle?: StyleProp<ViewStyle | TextStyle>;
|
|
62
|
-
/**
|
|
63
|
-
* The preset for the search input: default or prominent
|
|
64
|
-
*/
|
|
65
|
-
preset?: SearchInputPresets | `${SearchInputPresets}`;
|
|
66
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
-
export declare const LineDriver: (props: ComponentProps) => {
|
|
3
|
-
getLine: () => {
|
|
4
|
-
exists: () => boolean;
|
|
5
|
-
getStyle: () => any;
|
|
6
|
-
isVisible: () => boolean;
|
|
7
|
-
isEntryPointExists: () => boolean;
|
|
8
|
-
getEntryPointStyle: () => any;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { ViewDriver } from "../view/View.driver.new";
|
|
3
|
-
export const LineDriver = props => {
|
|
4
|
-
const lineDriver = ViewDriver({
|
|
5
|
-
renderTree: props.renderTree,
|
|
6
|
-
testID: `${props.testID}`
|
|
7
|
-
});
|
|
8
|
-
const entryPointDriver = ViewDriver({
|
|
9
|
-
renderTree: props.renderTree,
|
|
10
|
-
testID: `${props.testID}.entryPoint`
|
|
11
|
-
});
|
|
12
|
-
const getLine = () => {
|
|
13
|
-
const exists = () => {
|
|
14
|
-
return lineDriver.exists();
|
|
15
|
-
};
|
|
16
|
-
const getStyle = () => {
|
|
17
|
-
return StyleSheet.flatten(lineDriver.getElement().props.style);
|
|
18
|
-
};
|
|
19
|
-
const isVisible = () => {
|
|
20
|
-
const height = getStyle().height;
|
|
21
|
-
return exists() && (height ?? 0) > 0;
|
|
22
|
-
};
|
|
23
|
-
const isEntryPointExists = () => {
|
|
24
|
-
return entryPointDriver.exists();
|
|
25
|
-
};
|
|
26
|
-
const getEntryPointStyle = () => {
|
|
27
|
-
return entryPointDriver.getStyle();
|
|
28
|
-
};
|
|
29
|
-
return {
|
|
30
|
-
exists,
|
|
31
|
-
getStyle,
|
|
32
|
-
isVisible,
|
|
33
|
-
isEntryPointExists,
|
|
34
|
-
getEntryPointStyle
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
getLine
|
|
39
|
-
};
|
|
40
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { StyleSheet } from 'react-native';
|
|
2
|
-
import { TextDriver } from "../text/Text.driver.new";
|
|
3
|
-
import { ImageDriver } from "../image/Image.driver.new";
|
|
4
|
-
import { ViewDriver } from "../view/View.driver.new";
|
|
5
|
-
export const PointDriver = props => {
|
|
6
|
-
const pointDriver = ViewDriver({
|
|
7
|
-
renderTree: props.renderTree,
|
|
8
|
-
testID: `${props.testID}`
|
|
9
|
-
});
|
|
10
|
-
const labelDriver = TextDriver({
|
|
11
|
-
renderTree: props.renderTree,
|
|
12
|
-
testID: `${props.testID}.label`
|
|
13
|
-
});
|
|
14
|
-
const iconDriver = ImageDriver({
|
|
15
|
-
renderTree: props.renderTree,
|
|
16
|
-
testID: `${props.testID}.icon`
|
|
17
|
-
});
|
|
18
|
-
const getLabel = () => {
|
|
19
|
-
const exists = () => {
|
|
20
|
-
return labelDriver.exists();
|
|
21
|
-
};
|
|
22
|
-
return {
|
|
23
|
-
...labelDriver,
|
|
24
|
-
exists
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
const getIcon = () => {
|
|
28
|
-
const exists = () => {
|
|
29
|
-
return iconDriver.exists();
|
|
30
|
-
};
|
|
31
|
-
return {
|
|
32
|
-
...iconDriver,
|
|
33
|
-
exists
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
|
-
const getPoint = () => {
|
|
37
|
-
const exists = () => {
|
|
38
|
-
return pointDriver.exists();
|
|
39
|
-
};
|
|
40
|
-
const getStyle = () => {
|
|
41
|
-
return StyleSheet.flatten(pointDriver.getElement().props.style);
|
|
42
|
-
};
|
|
43
|
-
const getContentStyle = () => {
|
|
44
|
-
return getIcon().exists() ? StyleSheet.flatten(getIcon().getElement().props.style) : getLabel().exists() && StyleSheet.flatten(getLabel().getElement().props.style);
|
|
45
|
-
};
|
|
46
|
-
return {
|
|
47
|
-
exists,
|
|
48
|
-
getStyle,
|
|
49
|
-
getContentStyle
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
return {
|
|
53
|
-
getPoint
|
|
54
|
-
};
|
|
55
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from '../../testkit/new/Component.driver';
|
|
2
|
-
export declare const TimelineDriver: (props: ComponentProps) => {
|
|
3
|
-
getPoint: () => {
|
|
4
|
-
exists: () => boolean;
|
|
5
|
-
getStyle: () => any;
|
|
6
|
-
getContentStyle: () => any;
|
|
7
|
-
};
|
|
8
|
-
getTopLine: () => {
|
|
9
|
-
exists: () => boolean;
|
|
10
|
-
getStyle: () => any;
|
|
11
|
-
isVisible: () => boolean;
|
|
12
|
-
isEntryPointExists: () => boolean;
|
|
13
|
-
getEntryPointStyle: () => any;
|
|
14
|
-
};
|
|
15
|
-
getBottomLine: () => {
|
|
16
|
-
exists: () => boolean;
|
|
17
|
-
getStyle: () => any;
|
|
18
|
-
isVisible: () => boolean;
|
|
19
|
-
isEntryPointExists: () => boolean;
|
|
20
|
-
getEntryPointStyle: () => any;
|
|
21
|
-
};
|
|
22
|
-
getElement: () => import("react-test-renderer").ReactTestInstance;
|
|
23
|
-
queryElement: () => import("react-test-renderer").ReactTestInstance | undefined;
|
|
24
|
-
exists: () => boolean;
|
|
25
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useComponentDriver } from "../../testkit/new/Component.driver";
|
|
2
|
-
import { LineDriver } from "./line.driver";
|
|
3
|
-
import { PointDriver } from "./point.driver";
|
|
4
|
-
export const TimelineDriver = props => {
|
|
5
|
-
const driver = useComponentDriver(props);
|
|
6
|
-
const pointDriver = PointDriver({
|
|
7
|
-
renderTree: props.renderTree,
|
|
8
|
-
testID: `${props.testID}.point`
|
|
9
|
-
});
|
|
10
|
-
const topLineDriver = LineDriver({
|
|
11
|
-
renderTree: props.renderTree,
|
|
12
|
-
testID: `${props.testID}.topLine`
|
|
13
|
-
});
|
|
14
|
-
const bottomLineDriver = LineDriver({
|
|
15
|
-
renderTree: props.renderTree,
|
|
16
|
-
testID: `${props.testID}.bottomLine`
|
|
17
|
-
});
|
|
18
|
-
const getPoint = () => {
|
|
19
|
-
return {
|
|
20
|
-
...pointDriver.getPoint()
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
const getTopLine = () => {
|
|
24
|
-
return {
|
|
25
|
-
...topLineDriver.getLine()
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
const getBottomLine = () => {
|
|
29
|
-
return {
|
|
30
|
-
...bottomLineDriver.getLine()
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
return {
|
|
34
|
-
...driver,
|
|
35
|
-
getPoint,
|
|
36
|
-
getTopLine,
|
|
37
|
-
getBottomLine
|
|
38
|
-
};
|
|
39
|
-
};
|