react-native-ui-lib 7.41.1 → 7.42.0-snapshot.6978

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/lib/components/Keyboard/KeyboardInput/TextInputKeyboardManager/TextInputKeyboardManager.ios.js +1 -1
  2. package/lib/package.json +1 -1
  3. package/package.json +1 -1
  4. package/searchInput.d.ts +2 -0
  5. package/searchInput.js +1 -0
  6. package/src/components/button/button.api.json +5 -197
  7. package/src/components/chip/chip.driver.d.ts +33 -0
  8. package/src/components/chip/chip.driver.js +56 -0
  9. package/src/components/index.js +3 -0
  10. package/src/components/picker/Picker.driver.new.d.ts +32 -0
  11. package/src/components/picker/Picker.driver.new.js +7 -5
  12. package/src/components/picker/helpers/useNewPickerProps.js +11 -7
  13. package/src/components/searchInput/index.d.ts +37 -0
  14. package/src/components/searchInput/index.js +218 -0
  15. package/src/components/searchInput/searchInput.api.json +57 -0
  16. package/src/components/searchInput/types.d.ts +66 -0
  17. package/src/components/searchInput/types.js +5 -0
  18. package/src/components/tabController/apis/tabController.api.json +21 -5
  19. package/src/components/textField/useImperativeInputHandle.js +2 -0
  20. package/src/components/timeline/Line.d.ts +1 -0
  21. package/src/components/timeline/Line.js +5 -4
  22. package/src/components/timeline/Point.d.ts +1 -0
  23. package/src/components/timeline/Point.js +5 -4
  24. package/src/components/timeline/index.js +6 -5
  25. package/src/components/timeline/line.driver.d.ts +10 -0
  26. package/src/components/timeline/line.driver.js +40 -0
  27. package/src/components/timeline/point.driver.d.ts +8 -0
  28. package/src/components/timeline/point.driver.js +55 -0
  29. package/src/components/timeline/timeline.driver.d.ts +25 -0
  30. package/src/components/timeline/timeline.driver.js +39 -0
  31. package/src/components/wizard/wizard.api.json +7 -7
  32. package/src/index.d.ts +1 -0
  33. package/src/index.js +28 -0
  34. package/src/testkit/index.d.ts +2 -0
  35. package/src/testkit/index.js +3 -1
@@ -0,0 +1,218 @@
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);
@@ -0,0 +1,57 @@
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
+ }
@@ -0,0 +1,66 @@
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
+ };
@@ -0,0 +1,5 @@
1
+ export let SearchInputPresets = /*#__PURE__*/function (SearchInputPresets) {
2
+ SearchInputPresets["DEFAULT"] = "default";
3
+ SearchInputPresets["PROMINENT"] = "prominent";
4
+ return SearchInputPresets;
5
+ }({});
@@ -5,8 +5,17 @@
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
- {"name": "items", "type": "TabControllerItemProps[]", "description": "The list of tab bar items"},
9
- {"name": "initialIndex", "type": "number", "description": "Initial selected index", "default": "0"},
8
+ {
9
+ "name": "items",
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
+ },
10
19
  {
11
20
  "name": "onChangeIndex",
12
21
  "type": "(index: number, prevIndex: number | null) => void",
@@ -25,7 +34,11 @@
25
34
  "note": "Does not work with asCarousel",
26
35
  "default": "false"
27
36
  },
28
- {"name": "carouselPageWidth;", "type": "number", "description": "Pass for custom carousel page width"}
37
+ {
38
+ "name": "carouselPageWidth;",
39
+ "type": "number",
40
+ "description": "Pass for custom carousel page width"
41
+ }
29
42
  ],
30
43
  "snippet": [
31
44
  "<TabController items={[{label: 'First'}, {label: 'Second'}, {label: 'Third'}]$1}>",
@@ -75,7 +88,7 @@
75
88
  "items": [
76
89
  {
77
90
  "title": "",
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",
91
+ "description": "markdown: **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",
79
92
  "content": [
80
93
  {
81
94
  "value": "https://wixmp-1d257fba8470f1b562a0f5f2.wixmp.com/mads-docs-assets/assets/Components%20Docs/TabBar/tabBar_overview_styling.png"
@@ -88,7 +101,10 @@
88
101
  },
89
102
  {
90
103
  "type": "table",
91
- "columns": ["Property", "Component"],
104
+ "columns": [
105
+ "Property",
106
+ "Component"
107
+ ],
92
108
  "items": [
93
109
  {
94
110
  "title": "Counter Badge",
@@ -1,10 +1,12 @@
1
1
  import { useContext, useImperativeHandle, useRef } from 'react';
2
+ import { findNodeHandle } from 'react-native';
2
3
  import FieldContext from "./FieldContext";
3
4
  const useImperativeInputHandle = (ref, props) => {
4
5
  const inputRef = useRef();
5
6
  const context = useContext(FieldContext);
6
7
  useImperativeHandle(ref, () => {
7
8
  return {
9
+ getNodeHandle: () => inputRef.current ? findNodeHandle(inputRef.current) : null,
8
10
  isFocused: () => inputRef.current?.isFocused(),
9
11
  focus: () => inputRef.current?.focus(),
10
12
  blur: () => inputRef.current?.blur(),
@@ -4,6 +4,7 @@ import { LineProps } from './types';
4
4
  type LinePropsInternal = LineProps & {
5
5
  top?: boolean;
6
6
  style?: ViewStyle;
7
+ testID?: string;
7
8
  };
8
9
  declare const Line: React.MemoExoticComponent<(props: LinePropsInternal) => React.JSX.Element>;
9
10
  export default Line;
@@ -12,7 +12,8 @@ const Line = React.memo(props => {
12
12
  entry,
13
13
  top,
14
14
  style,
15
- width = LINE_WIDTH
15
+ width = LINE_WIDTH,
16
+ testID
16
17
  } = props;
17
18
  const solidLineStyle = useMemo(() => {
18
19
  return [style, styles.line, {
@@ -27,14 +28,14 @@ const Line = React.memo(props => {
27
28
  if (entry) {
28
29
  return <View style={[styles.entryPoint, {
29
30
  backgroundColor: color
30
- }]} />;
31
+ }]} testID={`${testID}.entryPoint`} />;
31
32
  }
32
33
  };
33
34
  const renderLine = () => {
34
35
  if (type === LineTypes.DASHED) {
35
- return <Dash vertical color={color} containerStyle={dashedLineStyle} />;
36
+ return <Dash vertical color={color} containerStyle={dashedLineStyle} testID={testID} />;
36
37
  }
37
- return <View style={solidLineStyle} />;
38
+ return <View style={solidLineStyle} testID={testID} />;
38
39
  };
39
40
  return <>
40
41
  {top && renderStartPoint()}
@@ -3,6 +3,7 @@ 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;
6
7
  };
7
8
  declare const Point: (props: PointPropsInternal) => React.JSX.Element;
8
9
  export default Point;
@@ -20,7 +20,8 @@ const Point = props => {
20
20
  label,
21
21
  type,
22
22
  color,
23
- onLayout
23
+ onLayout,
24
+ testID
24
25
  } = props;
25
26
  const pointStyle = useMemo(() => {
26
27
  const hasOutline = type === PointTypes.OUTLINE;
@@ -55,14 +56,14 @@ const Point = props => {
55
56
  const tintColor = removeIconBackground ? Colors.$iconDefault : Colors.$iconDefaultLight;
56
57
  const iconSize = removeIconBackground ? undefined : ICON_SIZE;
57
58
  if (icon) {
58
- return <Icon tintColor={tintColor} {...iconProps} size={iconSize} source={icon} />;
59
+ return <Icon testID={`${testID}.icon`} tintColor={tintColor} {...iconProps} size={iconSize} source={icon} />;
59
60
  } else if (label) {
60
- return <Text recorderTag={'unmask'} $textDefaultLight subtextBold color={labelColor}>
61
+ return <Text testID={`${testID}.label`} recorderTag={'unmask'} $textDefaultLight subtextBold color={labelColor}>
61
62
  {label}
62
63
  </Text>;
63
64
  }
64
65
  };
65
- return <View center style={pointStyle} onLayout={onLayout}>
66
+ return <View center style={pointStyle} onLayout={onLayout} testID={testID}>
66
67
  {renderPointContent()}
67
68
  </View>;
68
69
  };
@@ -15,7 +15,8 @@ const Timeline = props => {
15
15
  topLine,
16
16
  bottomLine,
17
17
  point,
18
- children
18
+ children,
19
+ testID
19
20
  } = themeProps;
20
21
  const [anchorMeasurements, setAnchorMeasurements] = useState();
21
22
  const [contentContainerMeasurements, setContentContainerMeasurements] = useState();
@@ -107,17 +108,17 @@ const Timeline = props => {
107
108
  });
108
109
  }, []);
109
110
  const renderTopLine = () => {
110
- return <Line {...topLine} top style={topLineStyle} color={topLine ? topLine?.color || getStateColor(topLine?.state) : undefined} />;
111
+ return <Line testID={`${testID}.topLine`} {...topLine} top style={topLineStyle} color={topLine ? topLine?.color || getStateColor(topLine?.state) : undefined} />;
111
112
  };
112
113
  const renderBottomLine = () => {
113
114
  if (bottomLine) {
114
- return <Line {...bottomLine} style={styles.bottomLine} color={bottomLine?.color || getStateColor(bottomLine?.state)} />;
115
+ return <Line testID={`${testID}.bottomLine`} {...bottomLine} style={styles.bottomLine} color={bottomLine?.color || getStateColor(bottomLine?.state)} />;
115
116
  }
116
117
  };
117
- return <View row style={containerStyle}>
118
+ return <View row style={containerStyle} testID={testID}>
118
119
  <View style={styles.timelineContainer}>
119
120
  {renderTopLine()}
120
- <Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)} />
121
+ <Point {...point} onLayout={onPointLayout} color={point?.color || getStateColor(point?.state)} testID={`${testID}.point`} />
121
122
  {renderBottomLine()}
122
123
  </View>
123
124
  <View style={styles.contentContainer} onLayout={onContentContainerLayout} ref={contentContainerRef}>
@@ -0,0 +1,10 @@
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
+ };
@@ -0,0 +1,40 @@
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
+ };
@@ -0,0 +1,8 @@
1
+ import { ComponentProps } from '../../testkit/new/Component.driver';
2
+ export declare const PointDriver: (props: ComponentProps) => {
3
+ getPoint: () => {
4
+ exists: () => boolean;
5
+ getStyle: () => any;
6
+ getContentStyle: () => any;
7
+ };
8
+ };
@@ -0,0 +1,55 @@
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
+ };
@@ -0,0 +1,25 @@
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
+ };