@hero-design/rn 7.17.0 → 7.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/es/index.js +3712 -3473
- package/lib/index.js +3716 -3475
- package/package.json +2 -2
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +12 -12
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +18 -18
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +26 -26
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -3
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +1 -1
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +2 -2
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/BottomNavigation/index.tsx +1 -1
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
- package/src/components/Button/Button.tsx +1 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +2 -2
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/Button/UtilityButton/{styled.tsx → StyledUtilityButton.tsx} +2 -2
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
- package/src/components/Button/UtilityButton/index.tsx +5 -1
- package/src/components/Button/__tests__/__snapshots__/IconButton.spec.tsx.snap +1 -1
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +69 -69
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +12 -12
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +1 -1
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +1 -1
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +6 -5
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +13 -12
- package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +12 -12
- package/src/components/Drawer/DragableDrawer/__tests__/__snapshots__/index.spec.tsx.snap +99 -0
- package/src/components/Drawer/DragableDrawer/__tests__/helpers.spec.ts +39 -0
- package/src/components/Drawer/DragableDrawer/__tests__/index.spec.tsx +24 -0
- package/src/components/Drawer/DragableDrawer/helpers.ts +43 -0
- package/src/components/Drawer/DragableDrawer/index.tsx +205 -0
- package/src/components/Drawer/StyledDrawer.tsx +70 -26
- package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/Drawer/index.tsx +4 -1
- package/src/components/Empty/StyledEmpty.tsx +4 -3
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +4 -3
- package/src/components/Empty/index.tsx +2 -2
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +28 -28
- package/src/components/FAB/ActionGroup/index.tsx +1 -1
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +2 -2
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +3 -3
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
- package/src/components/List/ListItem.tsx +1 -1
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +3 -3
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +20 -20
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +6 -6
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +12 -12
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +4 -4
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +22 -22
- package/src/components/Progress/ProgressCircle.tsx +25 -22
- package/src/components/Progress/StyledProgressCircle.tsx +33 -28
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +102 -92
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +5 -5
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +6 -6
- package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +3 -3
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +11 -11
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -6
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +3 -3
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +42 -42
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +126 -121
- package/src/components/Select/MultiSelect/index.tsx +1 -4
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +2 -2
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +36 -36
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +99 -94
- package/src/components/Select/SingleSelect/index.tsx +2 -6
- package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +2 -2
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +4 -4
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +8 -8
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
- package/src/components/Switch/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
- package/src/components/Tabs/ScrollableTabs.tsx +1 -1
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +8 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +85 -6
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +87 -8
- package/src/components/Tabs/__tests__/index.spec.tsx +8 -0
- package/src/components/Tabs/index.tsx +8 -3
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +9 -9
- package/src/components/TextInput/StyledTextInput.tsx +1 -0
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +50 -50
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +100 -87
- package/src/components/TextInput/index.tsx +2 -2
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +6 -5
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +13 -12
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +22 -22
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +12 -12
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +8 -8
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +13 -13
- package/src/index.ts +9 -1
- package/src/theme/ThemeProvider.ts +19 -0
- package/src/theme/ThemeSwitcher.tsx +27 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +161 -149
- package/src/theme/components/alert.ts +3 -3
- package/src/theme/components/badge.ts +1 -1
- package/src/theme/components/button.ts +9 -8
- package/src/theme/components/card.ts +4 -4
- package/src/theme/components/drawer.ts +14 -2
- package/src/theme/components/empty.ts +3 -2
- package/src/theme/components/list.ts +4 -4
- package/src/theme/components/pinInput.ts +2 -2
- package/src/theme/components/progress.ts +5 -5
- package/src/theme/components/toast.ts +3 -3
- package/src/theme/getTheme.ts +129 -0
- package/src/theme/global/colors/swag.ts +54 -0
- package/src/theme/global/colors/types.ts +45 -0
- package/src/theme/global/colors/work.ts +14 -0
- package/src/theme/global/index.ts +6 -2
- package/src/theme/index.ts +16 -143
- package/src/utils/scale.ts +4 -1
- package/types/components/Button/Button.d.ts +1 -0
- package/types/components/Button/UtilityButton/{styled.d.ts → StyledUtilityButton.d.ts} +0 -0
- package/types/components/Drawer/DragableDrawer/__tests__/helpers.spec.d.ts +1 -0
- package/types/components/Drawer/DragableDrawer/__tests__/index.spec.d.ts +1 -0
- package/types/components/Drawer/DragableDrawer/helpers.d.ts +8 -0
- package/types/components/Drawer/DragableDrawer/index.d.ts +33 -0
- package/types/components/Drawer/StyledDrawer.d.ts +34 -4
- package/types/components/Drawer/index.d.ts +4 -2
- package/types/components/Empty/index.d.ts +1 -1
- package/types/components/Icon/utils.d.ts +1 -1
- package/types/components/Progress/StyledProgressCircle.d.ts +12 -6
- package/types/index.d.ts +2 -2
- package/types/theme/ThemeProvider.d.ts +12 -0
- package/types/theme/ThemeSwitcher.d.ts +7 -0
- package/types/theme/components/button.d.ts +1 -1
- package/types/theme/components/drawer.d.ts +9 -0
- package/types/theme/components/empty.d.ts +3 -2
- package/types/theme/components/progress.d.ts +1 -2
- package/types/theme/getTheme.d.ts +74 -0
- package/types/theme/global/colors/swag.d.ts +3 -0
- package/types/theme/global/{colors.d.ts → colors/types.d.ts} +4 -3
- package/types/theme/global/colors/work.d.ts +3 -0
- package/types/theme/global/index.d.ts +7 -2
- package/types/theme/index.d.ts +7 -84
- package/src/theme/global/colors.ts +0 -50
|
@@ -41,7 +41,6 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
41
41
|
}: SingleSelectProps<V, T>) => {
|
|
42
42
|
const { isKeyboardVisible, keyboardHeight } = useKeyboard();
|
|
43
43
|
const [open, setOpen] = useState(false);
|
|
44
|
-
const [selectingValue, setSelectingValue] = useState<V | null>(value);
|
|
45
44
|
const sections = toSections(options);
|
|
46
45
|
const flatOptions = toFlatOptions(options);
|
|
47
46
|
const displayedValue = flatOptions.find(opt => value === opt.value)?.text;
|
|
@@ -73,10 +72,7 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
73
72
|
<BottomSheet
|
|
74
73
|
open={open}
|
|
75
74
|
onRequestClose={() => setOpen(false)}
|
|
76
|
-
onDismiss={
|
|
77
|
-
setSelectingValue(value);
|
|
78
|
-
if (onDimiss) onDimiss();
|
|
79
|
-
}}
|
|
75
|
+
onDismiss={onDimiss}
|
|
80
76
|
header={label}
|
|
81
77
|
style={{
|
|
82
78
|
paddingBottom: isKeyboardVisible ? keyboardHeight : 0,
|
|
@@ -99,7 +95,7 @@ const SingleSelect = <V, T extends OptionType<V>>({
|
|
|
99
95
|
loading={loading}
|
|
100
96
|
sections={sections}
|
|
101
97
|
renderOption={renderOption}
|
|
102
|
-
value={
|
|
98
|
+
value={value}
|
|
103
99
|
onPress={selectedValue => {
|
|
104
100
|
setOpen(false);
|
|
105
101
|
onConfirm(selectedValue);
|
|
@@ -5,7 +5,7 @@ exports[`FooterText has correct style 1`] = `
|
|
|
5
5
|
style={
|
|
6
6
|
Array [
|
|
7
7
|
Object {
|
|
8
|
-
"color": "#
|
|
8
|
+
"color": "#001f23",
|
|
9
9
|
"fontFamily": "BeVietnamPro-Regular",
|
|
10
10
|
"fontSize": 14,
|
|
11
11
|
"letterSpacing": 0.42,
|
|
@@ -13,7 +13,7 @@ exports[`FooterText has correct style 1`] = `
|
|
|
13
13
|
},
|
|
14
14
|
Array [
|
|
15
15
|
Object {
|
|
16
|
-
"color": "#
|
|
16
|
+
"color": "#8505a2",
|
|
17
17
|
},
|
|
18
18
|
undefined,
|
|
19
19
|
],
|
|
@@ -34,7 +34,7 @@ exports[`AnimatedSpinner renders correctly 1`] = `
|
|
|
34
34
|
style={
|
|
35
35
|
Array [
|
|
36
36
|
Object {
|
|
37
|
-
"backgroundColor": "#
|
|
37
|
+
"backgroundColor": "#8505a2",
|
|
38
38
|
"borderRadius": 8,
|
|
39
39
|
"height": 16,
|
|
40
40
|
"opacity": 1,
|
|
@@ -51,7 +51,7 @@ exports[`AnimatedSpinner renders correctly 1`] = `
|
|
|
51
51
|
style={
|
|
52
52
|
Array [
|
|
53
53
|
Object {
|
|
54
|
-
"backgroundColor": "#
|
|
54
|
+
"backgroundColor": "#8505a2",
|
|
55
55
|
"borderRadius": 8,
|
|
56
56
|
"height": 16,
|
|
57
57
|
"marginLeft": 8,
|
|
@@ -84,7 +84,7 @@ exports[`AnimatedSpinner renders correctly 1`] = `
|
|
|
84
84
|
style={
|
|
85
85
|
Array [
|
|
86
86
|
Object {
|
|
87
|
-
"backgroundColor": "#
|
|
87
|
+
"backgroundColor": "#8505a2",
|
|
88
88
|
"borderRadius": 8,
|
|
89
89
|
"height": 16,
|
|
90
90
|
"opacity": 0.5,
|
|
@@ -101,7 +101,7 @@ exports[`AnimatedSpinner renders correctly 1`] = `
|
|
|
101
101
|
style={
|
|
102
102
|
Array [
|
|
103
103
|
Object {
|
|
104
|
-
"backgroundColor": "#
|
|
104
|
+
"backgroundColor": "#8505a2",
|
|
105
105
|
"borderRadius": 8,
|
|
106
106
|
"height": 16,
|
|
107
107
|
"marginLeft": 8,
|
|
@@ -46,7 +46,7 @@ exports[`StyledSpinnerContainer renders correctly 1`] = `
|
|
|
46
46
|
style={
|
|
47
47
|
Array [
|
|
48
48
|
Object {
|
|
49
|
-
"backgroundColor": "#
|
|
49
|
+
"backgroundColor": "#8505a2",
|
|
50
50
|
"borderRadius": 8,
|
|
51
51
|
"height": 16,
|
|
52
52
|
"opacity": 1,
|
|
@@ -63,7 +63,7 @@ exports[`StyledSpinnerContainer renders correctly 1`] = `
|
|
|
63
63
|
style={
|
|
64
64
|
Array [
|
|
65
65
|
Object {
|
|
66
|
-
"backgroundColor": "#
|
|
66
|
+
"backgroundColor": "#8505a2",
|
|
67
67
|
"borderRadius": 8,
|
|
68
68
|
"height": 16,
|
|
69
69
|
"marginLeft": 8,
|
|
@@ -96,7 +96,7 @@ exports[`StyledSpinnerContainer renders correctly 1`] = `
|
|
|
96
96
|
style={
|
|
97
97
|
Array [
|
|
98
98
|
Object {
|
|
99
|
-
"backgroundColor": "#
|
|
99
|
+
"backgroundColor": "#8505a2",
|
|
100
100
|
"borderRadius": 8,
|
|
101
101
|
"height": 16,
|
|
102
102
|
"opacity": 0.5,
|
|
@@ -113,7 +113,7 @@ exports[`StyledSpinnerContainer renders correctly 1`] = `
|
|
|
113
113
|
style={
|
|
114
114
|
Array [
|
|
115
115
|
Object {
|
|
116
|
-
"backgroundColor": "#
|
|
116
|
+
"backgroundColor": "#8505a2",
|
|
117
117
|
"borderRadius": 8,
|
|
118
118
|
"height": 16,
|
|
119
119
|
"marginLeft": 8,
|
|
@@ -165,7 +165,7 @@ exports[`StyledSpinnerText renders correctly when position is bottomLeft 1`] = `
|
|
|
165
165
|
style={
|
|
166
166
|
Array [
|
|
167
167
|
Object {
|
|
168
|
-
"backgroundColor": "#
|
|
168
|
+
"backgroundColor": "#8505a2",
|
|
169
169
|
"borderRadius": 8,
|
|
170
170
|
"height": 16,
|
|
171
171
|
"opacity": 0.5,
|
|
@@ -183,7 +183,7 @@ exports[`StyledSpinnerText renders correctly when position is bottomRight 1`] =
|
|
|
183
183
|
style={
|
|
184
184
|
Array [
|
|
185
185
|
Object {
|
|
186
|
-
"backgroundColor": "#
|
|
186
|
+
"backgroundColor": "#8505a2",
|
|
187
187
|
"borderRadius": 8,
|
|
188
188
|
"height": 16,
|
|
189
189
|
"marginLeft": 8,
|
|
@@ -202,7 +202,7 @@ exports[`StyledSpinnerText renders correctly when position is topLeft 1`] = `
|
|
|
202
202
|
style={
|
|
203
203
|
Array [
|
|
204
204
|
Object {
|
|
205
|
-
"backgroundColor": "#
|
|
205
|
+
"backgroundColor": "#8505a2",
|
|
206
206
|
"borderRadius": 8,
|
|
207
207
|
"height": 16,
|
|
208
208
|
"opacity": 1,
|
|
@@ -220,7 +220,7 @@ exports[`StyledSpinnerText renders correctly when position is topRight 1`] = `
|
|
|
220
220
|
style={
|
|
221
221
|
Array [
|
|
222
222
|
Object {
|
|
223
|
-
"backgroundColor": "#
|
|
223
|
+
"backgroundColor": "#8505a2",
|
|
224
224
|
"borderRadius": 8,
|
|
225
225
|
"height": 16,
|
|
226
226
|
"marginLeft": 8,
|
|
@@ -55,7 +55,7 @@ exports[`Spinner renders correctly 1`] = `
|
|
|
55
55
|
style={
|
|
56
56
|
Array [
|
|
57
57
|
Object {
|
|
58
|
-
"backgroundColor": "#
|
|
58
|
+
"backgroundColor": "#8505a2",
|
|
59
59
|
"borderRadius": 8,
|
|
60
60
|
"height": 16,
|
|
61
61
|
"opacity": 1,
|
|
@@ -72,7 +72,7 @@ exports[`Spinner renders correctly 1`] = `
|
|
|
72
72
|
style={
|
|
73
73
|
Array [
|
|
74
74
|
Object {
|
|
75
|
-
"backgroundColor": "#
|
|
75
|
+
"backgroundColor": "#8505a2",
|
|
76
76
|
"borderRadius": 8,
|
|
77
77
|
"height": 16,
|
|
78
78
|
"marginLeft": 8,
|
|
@@ -105,7 +105,7 @@ exports[`Spinner renders correctly 1`] = `
|
|
|
105
105
|
style={
|
|
106
106
|
Array [
|
|
107
107
|
Object {
|
|
108
|
-
"backgroundColor": "#
|
|
108
|
+
"backgroundColor": "#8505a2",
|
|
109
109
|
"borderRadius": 8,
|
|
110
110
|
"height": 16,
|
|
111
111
|
"opacity": 0.5,
|
|
@@ -122,7 +122,7 @@ exports[`Spinner renders correctly 1`] = `
|
|
|
122
122
|
style={
|
|
123
123
|
Array [
|
|
124
124
|
Object {
|
|
125
|
-
"backgroundColor": "#
|
|
125
|
+
"backgroundColor": "#8505a2",
|
|
126
126
|
"borderRadius": 8,
|
|
127
127
|
"height": 16,
|
|
128
128
|
"marginLeft": 8,
|
|
@@ -19,7 +19,7 @@ exports[`Switch renders correctly 1`] = `
|
|
|
19
19
|
style={
|
|
20
20
|
Array [
|
|
21
21
|
Object {
|
|
22
|
-
"backgroundColor": "#
|
|
22
|
+
"backgroundColor": "#808f91",
|
|
23
23
|
"borderRadius": 999,
|
|
24
24
|
"height": 28.799999999999997,
|
|
25
25
|
"paddingHorizontal": 4,
|
|
@@ -83,7 +83,7 @@ exports[`Switch trigger press function correctly 1`] = `
|
|
|
83
83
|
style={
|
|
84
84
|
Array [
|
|
85
85
|
Object {
|
|
86
|
-
"backgroundColor": "#
|
|
86
|
+
"backgroundColor": "#808f91",
|
|
87
87
|
"borderRadius": 999,
|
|
88
88
|
"height": 28.799999999999997,
|
|
89
89
|
"paddingHorizontal": 4,
|
|
@@ -79,6 +79,7 @@ const ScrollableTab = ({
|
|
|
79
79
|
index: selectedTabIndex,
|
|
80
80
|
viewPosition: 0.5,
|
|
81
81
|
});
|
|
82
|
+
pagerViewRef.current?.setPage(selectedTabIndex);
|
|
82
83
|
}
|
|
83
84
|
|
|
84
85
|
const animation = Animated.parallel([
|
|
@@ -149,7 +150,6 @@ const ScrollableTab = ({
|
|
|
149
150
|
key={key}
|
|
150
151
|
onPress={() => {
|
|
151
152
|
onTabPress(key);
|
|
152
|
-
pagerViewRef.current?.setPage(index);
|
|
153
153
|
}}
|
|
154
154
|
testID={testID}
|
|
155
155
|
>
|
|
@@ -4,6 +4,7 @@ import { fireEvent } from '@testing-library/react-native';
|
|
|
4
4
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
5
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
6
6
|
import Tabs, { TabType } from '..';
|
|
7
|
+
import Button from '../../Button';
|
|
7
8
|
|
|
8
9
|
const TestTabsComponent = (
|
|
9
10
|
props: Omit<
|
|
@@ -40,6 +41,11 @@ const TestTabsComponent = (
|
|
|
40
41
|
insets: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
41
42
|
}}
|
|
42
43
|
>
|
|
44
|
+
<Button.Utility
|
|
45
|
+
text="Move to Work"
|
|
46
|
+
onPress={() => setSelectedTabKey('work')}
|
|
47
|
+
icon="sync"
|
|
48
|
+
/>
|
|
43
49
|
<Tabs.Scroll
|
|
44
50
|
{...props}
|
|
45
51
|
tabs={tabs}
|
|
@@ -65,6 +71,8 @@ describe('Tabs.Scroll', () => {
|
|
|
65
71
|
expect(getByText('Personal Screen')).toBeDefined();
|
|
66
72
|
fireEvent.press(getByTestId('hero-icon-home-outlined'));
|
|
67
73
|
expect(getByText('Home Screen')).toBeDefined();
|
|
74
|
+
fireEvent.press(getByText('Move to Work'));
|
|
75
|
+
expect(getByText('Work Screen')).toBeDefined();
|
|
68
76
|
});
|
|
69
77
|
|
|
70
78
|
it('renders correctly with lazy preloaded', () => {
|
|
@@ -12,6 +12,85 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
14
|
>
|
|
15
|
+
<View
|
|
16
|
+
accessible={true}
|
|
17
|
+
collapsable={false}
|
|
18
|
+
focusable={true}
|
|
19
|
+
nativeID="animatedComponent"
|
|
20
|
+
onClick={[Function]}
|
|
21
|
+
onResponderGrant={[Function]}
|
|
22
|
+
onResponderMove={[Function]}
|
|
23
|
+
onResponderRelease={[Function]}
|
|
24
|
+
onResponderTerminate={[Function]}
|
|
25
|
+
onResponderTerminationRequest={[Function]}
|
|
26
|
+
onStartShouldSetResponder={[Function]}
|
|
27
|
+
style={
|
|
28
|
+
Object {
|
|
29
|
+
"alignItems": "center",
|
|
30
|
+
"backgroundColor": "#f6f6f7",
|
|
31
|
+
"borderRadius": 8,
|
|
32
|
+
"flexDirection": "row",
|
|
33
|
+
"justifyContent": "center",
|
|
34
|
+
"opacity": 1,
|
|
35
|
+
"padding": 8,
|
|
36
|
+
"width": "100%",
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
<View
|
|
41
|
+
style={
|
|
42
|
+
Array [
|
|
43
|
+
Object {
|
|
44
|
+
"paddingRight": 12,
|
|
45
|
+
},
|
|
46
|
+
undefined,
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
<HeroIcon
|
|
51
|
+
name="sync"
|
|
52
|
+
style={
|
|
53
|
+
Array [
|
|
54
|
+
Object {
|
|
55
|
+
"color": "#001f23",
|
|
56
|
+
"fontSize": 24,
|
|
57
|
+
},
|
|
58
|
+
undefined,
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
testID="undefined-icon"
|
|
62
|
+
themeIntent="text"
|
|
63
|
+
themeSize="medium"
|
|
64
|
+
/>
|
|
65
|
+
</View>
|
|
66
|
+
<Text
|
|
67
|
+
style={
|
|
68
|
+
Array [
|
|
69
|
+
Object {
|
|
70
|
+
"color": "#001f23",
|
|
71
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
72
|
+
"fontSize": 14,
|
|
73
|
+
"letterSpacing": 0.42,
|
|
74
|
+
"lineHeight": 22,
|
|
75
|
+
},
|
|
76
|
+
Array [
|
|
77
|
+
Object {
|
|
78
|
+
"flexShrink": 1,
|
|
79
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
80
|
+
"fontSize": 16,
|
|
81
|
+
"textAlign": "center",
|
|
82
|
+
},
|
|
83
|
+
undefined,
|
|
84
|
+
],
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
themeFontSize="medium"
|
|
88
|
+
themeFontWeight="regular"
|
|
89
|
+
themeIntent="body"
|
|
90
|
+
>
|
|
91
|
+
Move to Work
|
|
92
|
+
</Text>
|
|
93
|
+
</View>
|
|
15
94
|
<View
|
|
16
95
|
style={
|
|
17
96
|
Array [
|
|
@@ -27,7 +106,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
27
106
|
style={
|
|
28
107
|
Array [
|
|
29
108
|
Object {
|
|
30
|
-
"borderBottomColor": "#
|
|
109
|
+
"borderBottomColor": "#e8e9ea",
|
|
31
110
|
"borderBottomWidth": 1,
|
|
32
111
|
"paddingHorizontal": 0,
|
|
33
112
|
},
|
|
@@ -148,7 +227,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
148
227
|
nativeID="animatedComponent"
|
|
149
228
|
style={
|
|
150
229
|
Object {
|
|
151
|
-
"backgroundColor": "#
|
|
230
|
+
"backgroundColor": "#f3e6f6",
|
|
152
231
|
"borderRadius": 8,
|
|
153
232
|
"flex": 1,
|
|
154
233
|
"transform": Array [
|
|
@@ -178,14 +257,14 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
178
257
|
style={
|
|
179
258
|
Array [
|
|
180
259
|
Object {
|
|
181
|
-
"color": "#
|
|
260
|
+
"color": "#001f23",
|
|
182
261
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
183
262
|
"fontSize": 14,
|
|
184
263
|
"letterSpacing": 0.42,
|
|
185
264
|
"lineHeight": 22,
|
|
186
265
|
},
|
|
187
266
|
Object {
|
|
188
|
-
"color": "#
|
|
267
|
+
"color": "#8505a2",
|
|
189
268
|
},
|
|
190
269
|
]
|
|
191
270
|
}
|
|
@@ -302,7 +381,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
302
381
|
style={
|
|
303
382
|
Array [
|
|
304
383
|
Object {
|
|
305
|
-
"color": "#
|
|
384
|
+
"color": "#001f23",
|
|
306
385
|
"fontSize": 20,
|
|
307
386
|
},
|
|
308
387
|
undefined,
|
|
@@ -419,7 +498,7 @@ exports[`Tabs.Scroll renders correctly 1`] = `
|
|
|
419
498
|
style={
|
|
420
499
|
Array [
|
|
421
500
|
Object {
|
|
422
|
-
"color": "#
|
|
501
|
+
"color": "#001f23",
|
|
423
502
|
"fontSize": 20,
|
|
424
503
|
},
|
|
425
504
|
undefined,
|
|
@@ -12,6 +12,85 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
12
12
|
]
|
|
13
13
|
}
|
|
14
14
|
>
|
|
15
|
+
<View
|
|
16
|
+
accessible={true}
|
|
17
|
+
collapsable={false}
|
|
18
|
+
focusable={true}
|
|
19
|
+
nativeID="animatedComponent"
|
|
20
|
+
onClick={[Function]}
|
|
21
|
+
onResponderGrant={[Function]}
|
|
22
|
+
onResponderMove={[Function]}
|
|
23
|
+
onResponderRelease={[Function]}
|
|
24
|
+
onResponderTerminate={[Function]}
|
|
25
|
+
onResponderTerminationRequest={[Function]}
|
|
26
|
+
onStartShouldSetResponder={[Function]}
|
|
27
|
+
style={
|
|
28
|
+
Object {
|
|
29
|
+
"alignItems": "center",
|
|
30
|
+
"backgroundColor": "#f6f6f7",
|
|
31
|
+
"borderRadius": 8,
|
|
32
|
+
"flexDirection": "row",
|
|
33
|
+
"justifyContent": "center",
|
|
34
|
+
"opacity": 1,
|
|
35
|
+
"padding": 8,
|
|
36
|
+
"width": "100%",
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
>
|
|
40
|
+
<View
|
|
41
|
+
style={
|
|
42
|
+
Array [
|
|
43
|
+
Object {
|
|
44
|
+
"paddingRight": 12,
|
|
45
|
+
},
|
|
46
|
+
undefined,
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
>
|
|
50
|
+
<HeroIcon
|
|
51
|
+
name="sync"
|
|
52
|
+
style={
|
|
53
|
+
Array [
|
|
54
|
+
Object {
|
|
55
|
+
"color": "#001f23",
|
|
56
|
+
"fontSize": 24,
|
|
57
|
+
},
|
|
58
|
+
undefined,
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
testID="undefined-icon"
|
|
62
|
+
themeIntent="text"
|
|
63
|
+
themeSize="medium"
|
|
64
|
+
/>
|
|
65
|
+
</View>
|
|
66
|
+
<Text
|
|
67
|
+
style={
|
|
68
|
+
Array [
|
|
69
|
+
Object {
|
|
70
|
+
"color": "#001f23",
|
|
71
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
72
|
+
"fontSize": 14,
|
|
73
|
+
"letterSpacing": 0.42,
|
|
74
|
+
"lineHeight": 22,
|
|
75
|
+
},
|
|
76
|
+
Array [
|
|
77
|
+
Object {
|
|
78
|
+
"flexShrink": 1,
|
|
79
|
+
"fontFamily": "BeVietnamPro-Regular",
|
|
80
|
+
"fontSize": 16,
|
|
81
|
+
"textAlign": "center",
|
|
82
|
+
},
|
|
83
|
+
undefined,
|
|
84
|
+
],
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
themeFontSize="medium"
|
|
88
|
+
themeFontWeight="regular"
|
|
89
|
+
themeIntent="body"
|
|
90
|
+
>
|
|
91
|
+
Move to Work
|
|
92
|
+
</Text>
|
|
93
|
+
</View>
|
|
15
94
|
<View
|
|
16
95
|
style={
|
|
17
96
|
Array [
|
|
@@ -27,7 +106,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
27
106
|
style={
|
|
28
107
|
Array [
|
|
29
108
|
Object {
|
|
30
|
-
"borderBottomColor": "#
|
|
109
|
+
"borderBottomColor": "#e8e9ea",
|
|
31
110
|
"borderBottomWidth": 1,
|
|
32
111
|
"paddingHorizontal": 0,
|
|
33
112
|
},
|
|
@@ -82,14 +161,14 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
82
161
|
style={
|
|
83
162
|
Array [
|
|
84
163
|
Object {
|
|
85
|
-
"color": "#
|
|
164
|
+
"color": "#001f23",
|
|
86
165
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
87
166
|
"fontSize": 14,
|
|
88
167
|
"letterSpacing": 0.42,
|
|
89
168
|
"lineHeight": 22,
|
|
90
169
|
},
|
|
91
170
|
Object {
|
|
92
|
-
"color": "#
|
|
171
|
+
"color": "#001f23",
|
|
93
172
|
},
|
|
94
173
|
]
|
|
95
174
|
}
|
|
@@ -150,14 +229,14 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
150
229
|
style={
|
|
151
230
|
Array [
|
|
152
231
|
Object {
|
|
153
|
-
"color": "#
|
|
232
|
+
"color": "#001f23",
|
|
154
233
|
"fontFamily": "BeVietnamPro-Regular",
|
|
155
234
|
"fontSize": 14,
|
|
156
235
|
"letterSpacing": 0.42,
|
|
157
236
|
"lineHeight": 22,
|
|
158
237
|
},
|
|
159
238
|
Object {
|
|
160
|
-
"color": "#
|
|
239
|
+
"color": "#001f23",
|
|
161
240
|
},
|
|
162
241
|
]
|
|
163
242
|
}
|
|
@@ -218,14 +297,14 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
218
297
|
style={
|
|
219
298
|
Array [
|
|
220
299
|
Object {
|
|
221
|
-
"color": "#
|
|
300
|
+
"color": "#001f23",
|
|
222
301
|
"fontFamily": "BeVietnamPro-Regular",
|
|
223
302
|
"fontSize": 14,
|
|
224
303
|
"letterSpacing": 0.42,
|
|
225
304
|
"lineHeight": 22,
|
|
226
305
|
},
|
|
227
306
|
Object {
|
|
228
|
-
"color": "#
|
|
307
|
+
"color": "#001f23",
|
|
229
308
|
},
|
|
230
309
|
]
|
|
231
310
|
}
|
|
@@ -265,7 +344,7 @@ exports[`Tabs renders correctly 1`] = `
|
|
|
265
344
|
nativeID="animatedComponent"
|
|
266
345
|
style={
|
|
267
346
|
Object {
|
|
268
|
-
"backgroundColor": "#
|
|
347
|
+
"backgroundColor": "#001f23",
|
|
269
348
|
"bottom": 0,
|
|
270
349
|
"height": 2,
|
|
271
350
|
"position": "absolute",
|
|
@@ -4,6 +4,7 @@ import { fireEvent } from '@testing-library/react-native';
|
|
|
4
4
|
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
5
|
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
6
6
|
import Tabs, { TabType } from '..';
|
|
7
|
+
import Button from '../../Button';
|
|
7
8
|
|
|
8
9
|
const TestTabsComponent = (
|
|
9
10
|
props: Omit<
|
|
@@ -38,6 +39,11 @@ const TestTabsComponent = (
|
|
|
38
39
|
insets: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
39
40
|
}}
|
|
40
41
|
>
|
|
42
|
+
<Button.Utility
|
|
43
|
+
text="Move to Work"
|
|
44
|
+
onPress={() => setSelectedTabKey('work')}
|
|
45
|
+
icon="sync"
|
|
46
|
+
/>
|
|
41
47
|
<Tabs
|
|
42
48
|
{...props}
|
|
43
49
|
tabs={tabs}
|
|
@@ -61,6 +67,8 @@ describe('Tabs', () => {
|
|
|
61
67
|
expect(getByText('Personal Screen')).toBeDefined();
|
|
62
68
|
fireEvent.press(getByText('Home'));
|
|
63
69
|
expect(getByText('Home Screen')).toBeDefined();
|
|
70
|
+
fireEvent.press(getByText('Move to Work'));
|
|
71
|
+
expect(getByText('Work Screen')).toBeDefined();
|
|
64
72
|
});
|
|
65
73
|
|
|
66
74
|
it('renders correctly with lazy preloaded', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { ReactNode } from 'react';
|
|
1
|
+
import React, { ReactNode, useEffect } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Animated,
|
|
4
4
|
TouchableWithoutFeedback,
|
|
@@ -118,6 +118,12 @@ const Tabs = ({
|
|
|
118
118
|
const positionAnimatedValue = React.useRef(new Animated.Value(0)).current;
|
|
119
119
|
const [tabsWidth, setTabsWidth] = React.useState<number>(0);
|
|
120
120
|
|
|
121
|
+
useEffect(() => {
|
|
122
|
+
if (selectedTabIndex !== -1) {
|
|
123
|
+
pagerViewRef.current?.setPage(selectedTabIndex);
|
|
124
|
+
}
|
|
125
|
+
}, [selectedTabIndex]);
|
|
126
|
+
|
|
121
127
|
return (
|
|
122
128
|
<TabContainer style={containerStyle}>
|
|
123
129
|
<HeaderTabWrapper themeInsets={insets} style={barStyle}>
|
|
@@ -130,7 +136,7 @@ const Tabs = ({
|
|
|
130
136
|
}
|
|
131
137
|
}}
|
|
132
138
|
>
|
|
133
|
-
{tabs.map(
|
|
139
|
+
{tabs.map(tab => {
|
|
134
140
|
const {
|
|
135
141
|
key,
|
|
136
142
|
testID,
|
|
@@ -152,7 +158,6 @@ const Tabs = ({
|
|
|
152
158
|
key={key}
|
|
153
159
|
onPress={() => {
|
|
154
160
|
onTabPress(key);
|
|
155
|
-
pagerViewRef.current?.setPage(index);
|
|
156
161
|
}}
|
|
157
162
|
testID={testID}
|
|
158
163
|
>
|
|
@@ -5,7 +5,7 @@ exports[`Tag has archived style when intent is archived 1`] = `
|
|
|
5
5
|
style={
|
|
6
6
|
Array [
|
|
7
7
|
Object {
|
|
8
|
-
"backgroundColor": "#
|
|
8
|
+
"backgroundColor": "#f6f6f7",
|
|
9
9
|
"borderColor": "#737479",
|
|
10
10
|
"borderRadius": 4,
|
|
11
11
|
"borderWidth": 1,
|
|
@@ -43,8 +43,8 @@ exports[`Tag has archived style when intent is primary 1`] = `
|
|
|
43
43
|
style={
|
|
44
44
|
Array [
|
|
45
45
|
Object {
|
|
46
|
-
"backgroundColor": "#
|
|
47
|
-
"borderColor": "#
|
|
46
|
+
"backgroundColor": "#f3e6f6",
|
|
47
|
+
"borderColor": "#8505a2",
|
|
48
48
|
"borderRadius": 4,
|
|
49
49
|
"borderWidth": 1,
|
|
50
50
|
"paddingHorizontal": 8,
|
|
@@ -59,7 +59,7 @@ exports[`Tag has archived style when intent is primary 1`] = `
|
|
|
59
59
|
style={
|
|
60
60
|
Array [
|
|
61
61
|
Object {
|
|
62
|
-
"color": "#
|
|
62
|
+
"color": "#8505a2",
|
|
63
63
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
64
64
|
"fontSize": 12,
|
|
65
65
|
"includeFontPadding": false,
|
|
@@ -120,7 +120,7 @@ exports[`Tag has default style when intent is default 1`] = `
|
|
|
120
120
|
Array [
|
|
121
121
|
Object {
|
|
122
122
|
"backgroundColor": undefined,
|
|
123
|
-
"borderColor": "#
|
|
123
|
+
"borderColor": "#001f23",
|
|
124
124
|
"borderRadius": 4,
|
|
125
125
|
"borderWidth": 1,
|
|
126
126
|
"paddingHorizontal": 8,
|
|
@@ -135,7 +135,7 @@ exports[`Tag has default style when intent is default 1`] = `
|
|
|
135
135
|
style={
|
|
136
136
|
Array [
|
|
137
137
|
Object {
|
|
138
|
-
"color": "#
|
|
138
|
+
"color": "#001f23",
|
|
139
139
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
140
140
|
"fontSize": 12,
|
|
141
141
|
"includeFontPadding": false,
|
|
@@ -233,8 +233,8 @@ exports[`Tag has warning style when intent is warning 1`] = `
|
|
|
233
233
|
style={
|
|
234
234
|
Array [
|
|
235
235
|
Object {
|
|
236
|
-
"backgroundColor": "#
|
|
237
|
-
"borderColor": "#
|
|
236
|
+
"backgroundColor": "#ebf4ff",
|
|
237
|
+
"borderColor": "#ffa234",
|
|
238
238
|
"borderRadius": 4,
|
|
239
239
|
"borderWidth": 1,
|
|
240
240
|
"paddingHorizontal": 8,
|
|
@@ -249,7 +249,7 @@ exports[`Tag has warning style when intent is warning 1`] = `
|
|
|
249
249
|
style={
|
|
250
250
|
Array [
|
|
251
251
|
Object {
|
|
252
|
-
"color": "#
|
|
252
|
+
"color": "#ffa234",
|
|
253
253
|
"fontFamily": "BeVietnamPro-SemiBold",
|
|
254
254
|
"fontSize": 12,
|
|
255
255
|
"includeFontPadding": false,
|