@hero-design/rn 8.52.1 → 8.52.2-rc2.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 +1 -1
- package/CHANGELOG.md +20 -0
- package/es/index.js +397 -687
- package/lib/index.js +395 -686
- package/package.json +7 -7
- package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +0 -4
- package/src/components/Accordion/__tests__/__snapshots__/StyledAccordion.spec.tsx.snap +0 -2
- package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +0 -7
- package/src/components/Attachment/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/StyledAvatarStack.spec.tsx.snap +0 -2
- package/src/components/Avatar/AvatarStack/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +0 -3
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +0 -6
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +0 -2
- package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +32 -21
- package/src/components/BottomSheet/index.tsx +1 -1
- package/src/components/Box/__tests__/__snapshots__/index.spec.tsx.snap +0 -21
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +0 -10
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +0 -10
- package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/Button/__tests__/__snapshots__/Button.spec.tsx.snap +0 -16
- package/src/components/Button/__tests__/__snapshots__/IconButton.spec.tsx.snap +0 -1
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +0 -32
- package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +0 -5
- package/src/components/Card/DataCard/__tests__/__snapshots__/StyledDataCard.spec.tsx.snap +0 -7
- package/src/components/Card/DataCard/__tests__/__snapshots__/index.spec.tsx.snap +0 -5
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +0 -1
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +0 -6
- package/src/components/Carousel/__tests__/__snapshots__/CardCarousel.spec.tsx.snap +0 -2
- package/src/components/Carousel/__tests__/__snapshots__/StyledCardCarousel.spec.tsx.snap +0 -4
- package/src/components/Carousel/__tests__/__snapshots__/StyledCarousel.spec.tsx.snap +0 -1
- package/src/components/Carousel/__tests__/__snapshots__/index.spec.tsx.snap +1 -803
- package/src/components/Carousel/__tests__/index.spec.tsx +37 -47
- package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +0 -8
- package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +0 -6
- package/src/components/Checkbox/index.tsx +1 -13
- package/src/components/Chip/__tests__/__snapshots__/index.spec.tsx.snap +0 -12
- package/src/components/Collapse/__tests__/__snapshots__/StyledCollapse.spec.tsx.snap +0 -2
- package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +0 -1
- package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/DatePicker/__tests__/__snapshots__/DatePicker.spec.tsx.snap +0 -15
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +0 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerCalendar.spec.tsx.snap +0 -1
- package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +309 -329
- package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +0 -12
- package/src/components/Drawer/DragableDrawer/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/Error/__tests__/__snapshots__/index.spec.tsx.snap +0 -4
- package/src/components/Error/index.tsx +3 -20
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/FAB/ActionGroup/index.tsx +1 -14
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +0 -2
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +0 -3
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/HeroDesignProvider/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +0 -4
- package/src/components/Image/__tests__/__snapshots__/index.spec.tsx.snap +0 -4
- package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +0 -2
- package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +0 -4
- package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +0 -4
- package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +0 -9
- package/src/components/Modal/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/PageControl/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +0 -5
- package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +0 -4
- package/src/components/Portal/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +0 -5
- package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +0 -2
- package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +0 -1
- package/src/components/Rate/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/RefreshControl/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +0 -1
- package/src/components/RichTextEditor/__tests__/__snapshots__/MentionList.spec.tsx.snap +0 -1
- package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +0 -2
- package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +0 -4
- package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +0 -6
- package/src/components/SectionHeading/__tests__/index.spec.tsx +0 -1
- package/src/components/SectionHeading/index.tsx +32 -57
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +0 -1
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +0 -4
- package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +128 -42
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +0 -1
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +0 -4
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +96 -35
- package/src/components/Skeleton/__tests__/__snapshots__/index.spec.tsx.snap +0 -7
- package/src/components/Slider/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +0 -1
- package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +0 -24
- package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/Success/__tests__/__snapshots__/index.spec.tsx.snap +0 -4
- package/src/components/Swipeable/__tests__/__snapshots__/SwipeableAction.spec.tsx.snap +0 -3
- package/src/components/Swipeable/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/Option.spec.tsx.snap +0 -4
- package/src/components/Switch/SelectorSwitch/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/Switch/__tests__/__snapshots__/StyledSwitch.spec.tsx.snap +0 -5
- package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +0 -2
- package/src/components/Tabs/__tests__/SceneView.spec.tsx +1 -1
- package/src/components/Tabs/__tests__/__snapshots__/SceneView.spec.tsx.snap +0 -4
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +0 -3
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabsHeader.spec.tsx.snap +0 -1
- package/src/components/Tabs/__tests__/__snapshots__/TabWithBadge.spec.tsx.snap +0 -2
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +0 -3
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +0 -10
- package/src/components/Tag/index.tsx +0 -12
- package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +0 -21
- package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +0 -17
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +0 -2
- package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +309 -330
- package/src/components/Toast/StyledToast.tsx +7 -9
- package/src/components/Toast/Toast.tsx +1 -4
- package/src/components/Toast/ToastContainer.tsx +2 -6
- package/src/components/Toast/ToastContext.ts +2 -5
- package/src/components/Toast/ToastProvider.tsx +2 -19
- package/src/components/Toast/__tests__/ToastContainer.spec.tsx +12 -15
- package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +0 -7
- package/src/components/Toast/__tests__/__snapshots__/ToastContainer.spec.tsx.snap +6 -14
- package/src/components/Toast/types.ts +1 -5
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +0 -3
- package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +0 -8
- package/src/components/Typography/Body/__tests__/__snapshots__/StyledBody.tsx.snap +0 -16
- package/src/components/Typography/Body/__tests__/__snapshots__/index.spec.tsx.snap +0 -19
- package/src/components/Typography/Caption/__tests__/__snapshots__/StyledCaption.spec.tsx.snap +0 -10
- package/src/components/Typography/Caption/__tests__/__snapshots__/index.spec.tsx.snap +0 -13
- package/src/components/Typography/Label/__tests__/__snapshots__/StyledLabel.tsx.snap +0 -8
- package/src/components/Typography/Label/__tests__/__snapshots__/index.spec.tsx.snap +0 -11
- package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +0 -20
- package/src/components/Typography/Title/__tests__/__snapshots__/StyledTitle.tsx.snap +0 -20
- package/src/components/Typography/Title/__tests__/__snapshots__/index.spec.tsx.snap +0 -23
- package/src/index.ts +0 -2
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +0 -102
- package/src/theme/components/badge.ts +1 -28
- package/src/theme/components/button.ts +0 -24
- package/src/theme/components/carousel.ts +1 -28
- package/src/theme/components/empty.ts +1 -23
- package/src/theme/components/error.ts +1 -32
- package/src/theme/components/fab.ts +2 -13
- package/src/theme/components/pinInput.ts +0 -32
- package/src/theme/components/success.ts +1 -23
- package/src/theme/components/tag.ts +1 -28
- package/src/theme/components/textInput.ts +0 -5
- package/src/theme/getTheme.ts +18 -21
- package/src/types.ts +0 -2
- package/types/components/Checkbox/index.d.ts +1 -6
- package/types/components/Error/index.d.ts +3 -9
- package/types/components/FAB/ActionGroup/index.d.ts +0 -5
- package/types/components/SectionHeading/index.d.ts +1 -11
- package/types/components/Tag/index.d.ts +1 -6
- package/types/components/Toast/StyledToast.d.ts +0 -2
- package/types/components/Toast/ToastContext.d.ts +2 -2
- package/types/components/Toast/ToastProvider.d.ts +1 -1
- package/types/components/Toast/index.d.ts +1 -1
- package/types/components/Toast/types.d.ts +1 -5
- package/types/index.d.ts +1 -2
- package/types/theme/components/badge.d.ts +0 -24
- package/types/theme/components/button.d.ts +0 -20
- package/types/theme/components/carousel.d.ts +0 -24
- package/types/theme/components/empty.d.ts +0 -19
- package/types/theme/components/error.d.ts +0 -27
- package/types/theme/components/fab.d.ts +8 -19
- package/types/theme/components/pinInput.d.ts +0 -27
- package/types/theme/components/success.d.ts +0 -19
- package/types/theme/components/tag.d.ts +0 -24
- package/types/theme/components/textInput.d.ts +0 -5
- package/types/theme/getTheme.d.ts +18 -20
- package/types/types.d.ts +1 -2
- package/src/components/BottomNavigation/StyledBottomNavigation.tsx +0 -60
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +0 -413
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +0 -97
- package/src/components/BottomNavigation/index.tsx +0 -166
- package/src/theme/components/bottomNavigation.ts +0 -27
- package/types/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -52
- package/types/components/BottomNavigation/index.d.ts +0 -45
- package/types/theme/components/bottomNavigation.d.ts +0 -23
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`BottomNavigation renders correctly 1`] = `
|
|
4
|
-
<View
|
|
5
|
-
style={
|
|
6
|
-
{
|
|
7
|
-
"flex": 1,
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
>
|
|
11
|
-
<RNCSafeAreaProvider
|
|
12
|
-
onInsetsChange={[Function]}
|
|
13
|
-
style={
|
|
14
|
-
[
|
|
15
|
-
{
|
|
16
|
-
"flex": 1,
|
|
17
|
-
},
|
|
18
|
-
undefined,
|
|
19
|
-
]
|
|
20
|
-
}
|
|
21
|
-
>
|
|
22
|
-
<View
|
|
23
|
-
style={
|
|
24
|
-
[
|
|
25
|
-
{
|
|
26
|
-
"flex": 1,
|
|
27
|
-
"overflow": "hidden",
|
|
28
|
-
},
|
|
29
|
-
undefined,
|
|
30
|
-
]
|
|
31
|
-
}
|
|
32
|
-
>
|
|
33
|
-
<View
|
|
34
|
-
style={
|
|
35
|
-
[
|
|
36
|
-
{
|
|
37
|
-
"flex": 1,
|
|
38
|
-
},
|
|
39
|
-
undefined,
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
>
|
|
43
|
-
<View
|
|
44
|
-
accessibilityElementsHidden={false}
|
|
45
|
-
collapsable={false}
|
|
46
|
-
importantForAccessibility="auto"
|
|
47
|
-
pointerEvents="auto"
|
|
48
|
-
removeClippedSubviews={false}
|
|
49
|
-
style={
|
|
50
|
-
[
|
|
51
|
-
{
|
|
52
|
-
"display": "flex",
|
|
53
|
-
"flex": 1,
|
|
54
|
-
},
|
|
55
|
-
undefined,
|
|
56
|
-
]
|
|
57
|
-
}
|
|
58
|
-
themeVisibility={true}
|
|
59
|
-
>
|
|
60
|
-
<Text>
|
|
61
|
-
Home Screen
|
|
62
|
-
</Text>
|
|
63
|
-
</View>
|
|
64
|
-
</View>
|
|
65
|
-
<View
|
|
66
|
-
style={
|
|
67
|
-
[
|
|
68
|
-
{
|
|
69
|
-
"backgroundColor": "#ffffff",
|
|
70
|
-
"elevation": 10,
|
|
71
|
-
"height": 72,
|
|
72
|
-
"paddingBottom": 0,
|
|
73
|
-
"paddingLeft": 0,
|
|
74
|
-
"paddingRight": 0,
|
|
75
|
-
"shadowColor": "#401960",
|
|
76
|
-
"shadowOffset": {
|
|
77
|
-
"height": 3,
|
|
78
|
-
"width": 0,
|
|
79
|
-
},
|
|
80
|
-
"shadowOpacity": 0.27,
|
|
81
|
-
"shadowRadius": 4.65,
|
|
82
|
-
},
|
|
83
|
-
undefined,
|
|
84
|
-
]
|
|
85
|
-
}
|
|
86
|
-
themeInsets={
|
|
87
|
-
{
|
|
88
|
-
"bottom": 0,
|
|
89
|
-
"left": 0,
|
|
90
|
-
"right": 0,
|
|
91
|
-
"top": 0,
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
>
|
|
95
|
-
<View
|
|
96
|
-
style={
|
|
97
|
-
[
|
|
98
|
-
{
|
|
99
|
-
"alignItems": "center",
|
|
100
|
-
"flex": 1,
|
|
101
|
-
"flexDirection": "row",
|
|
102
|
-
"overflow": "hidden",
|
|
103
|
-
},
|
|
104
|
-
undefined,
|
|
105
|
-
]
|
|
106
|
-
}
|
|
107
|
-
>
|
|
108
|
-
<View
|
|
109
|
-
accessibilityState={
|
|
110
|
-
{
|
|
111
|
-
"busy": undefined,
|
|
112
|
-
"checked": undefined,
|
|
113
|
-
"disabled": undefined,
|
|
114
|
-
"expanded": undefined,
|
|
115
|
-
"selected": undefined,
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
accessible={true}
|
|
119
|
-
focusable={true}
|
|
120
|
-
onClick={[Function]}
|
|
121
|
-
onResponderGrant={[Function]}
|
|
122
|
-
onResponderMove={[Function]}
|
|
123
|
-
onResponderRelease={[Function]}
|
|
124
|
-
onResponderTerminate={[Function]}
|
|
125
|
-
onResponderTerminationRequest={[Function]}
|
|
126
|
-
onStartShouldSetResponder={[Function]}
|
|
127
|
-
style={
|
|
128
|
-
[
|
|
129
|
-
{
|
|
130
|
-
"alignItems": "center",
|
|
131
|
-
"flex": 1,
|
|
132
|
-
},
|
|
133
|
-
undefined,
|
|
134
|
-
]
|
|
135
|
-
}
|
|
136
|
-
>
|
|
137
|
-
<HeroIcon
|
|
138
|
-
name="home"
|
|
139
|
-
style={
|
|
140
|
-
[
|
|
141
|
-
{
|
|
142
|
-
"color": "#401960",
|
|
143
|
-
"fontSize": 24,
|
|
144
|
-
},
|
|
145
|
-
undefined,
|
|
146
|
-
]
|
|
147
|
-
}
|
|
148
|
-
testID="hero-icon-home"
|
|
149
|
-
themeIntent="primary"
|
|
150
|
-
themeSize="medium"
|
|
151
|
-
/>
|
|
152
|
-
<Text
|
|
153
|
-
allowFontScaling={false}
|
|
154
|
-
numberOfLines={1}
|
|
155
|
-
style={
|
|
156
|
-
[
|
|
157
|
-
{
|
|
158
|
-
"color": "#401960",
|
|
159
|
-
"fontFamily": "BeVietnamPro-SemiBold",
|
|
160
|
-
"fontSize": 12,
|
|
161
|
-
"letterSpacing": 0.24,
|
|
162
|
-
"lineHeight": 16,
|
|
163
|
-
},
|
|
164
|
-
[
|
|
165
|
-
{
|
|
166
|
-
"marginTop": 4,
|
|
167
|
-
},
|
|
168
|
-
undefined,
|
|
169
|
-
],
|
|
170
|
-
]
|
|
171
|
-
}
|
|
172
|
-
themeFontWeight="semi-bold"
|
|
173
|
-
themeIntent="primary"
|
|
174
|
-
>
|
|
175
|
-
Home
|
|
176
|
-
</Text>
|
|
177
|
-
</View>
|
|
178
|
-
<View
|
|
179
|
-
accessibilityState={
|
|
180
|
-
{
|
|
181
|
-
"busy": undefined,
|
|
182
|
-
"checked": undefined,
|
|
183
|
-
"disabled": undefined,
|
|
184
|
-
"expanded": undefined,
|
|
185
|
-
"selected": undefined,
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
accessible={true}
|
|
189
|
-
focusable={true}
|
|
190
|
-
onClick={[Function]}
|
|
191
|
-
onResponderGrant={[Function]}
|
|
192
|
-
onResponderMove={[Function]}
|
|
193
|
-
onResponderRelease={[Function]}
|
|
194
|
-
onResponderTerminate={[Function]}
|
|
195
|
-
onResponderTerminationRequest={[Function]}
|
|
196
|
-
onStartShouldSetResponder={[Function]}
|
|
197
|
-
style={
|
|
198
|
-
[
|
|
199
|
-
{
|
|
200
|
-
"alignItems": "center",
|
|
201
|
-
"flex": 1,
|
|
202
|
-
},
|
|
203
|
-
undefined,
|
|
204
|
-
]
|
|
205
|
-
}
|
|
206
|
-
>
|
|
207
|
-
<HeroIcon
|
|
208
|
-
name="speaker-outlined"
|
|
209
|
-
style={
|
|
210
|
-
[
|
|
211
|
-
{
|
|
212
|
-
"color": "#001f23",
|
|
213
|
-
"fontSize": 24,
|
|
214
|
-
},
|
|
215
|
-
undefined,
|
|
216
|
-
]
|
|
217
|
-
}
|
|
218
|
-
testID="hero-icon-speaker-outlined"
|
|
219
|
-
themeIntent="text"
|
|
220
|
-
themeSize="medium"
|
|
221
|
-
/>
|
|
222
|
-
<Text
|
|
223
|
-
allowFontScaling={false}
|
|
224
|
-
numberOfLines={1}
|
|
225
|
-
style={
|
|
226
|
-
[
|
|
227
|
-
{
|
|
228
|
-
"color": "#001f23",
|
|
229
|
-
"fontFamily": "BeVietnamPro-SemiBold",
|
|
230
|
-
"fontSize": 12,
|
|
231
|
-
"letterSpacing": 0.24,
|
|
232
|
-
"lineHeight": 16,
|
|
233
|
-
},
|
|
234
|
-
[
|
|
235
|
-
{
|
|
236
|
-
"marginTop": 4,
|
|
237
|
-
},
|
|
238
|
-
undefined,
|
|
239
|
-
],
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
themeFontWeight="semi-bold"
|
|
243
|
-
themeIntent="body"
|
|
244
|
-
>
|
|
245
|
-
Feed
|
|
246
|
-
</Text>
|
|
247
|
-
</View>
|
|
248
|
-
<View
|
|
249
|
-
accessibilityState={
|
|
250
|
-
{
|
|
251
|
-
"busy": undefined,
|
|
252
|
-
"checked": undefined,
|
|
253
|
-
"disabled": undefined,
|
|
254
|
-
"expanded": undefined,
|
|
255
|
-
"selected": undefined,
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
accessible={true}
|
|
259
|
-
focusable={true}
|
|
260
|
-
onClick={[Function]}
|
|
261
|
-
onResponderGrant={[Function]}
|
|
262
|
-
onResponderMove={[Function]}
|
|
263
|
-
onResponderRelease={[Function]}
|
|
264
|
-
onResponderTerminate={[Function]}
|
|
265
|
-
onResponderTerminationRequest={[Function]}
|
|
266
|
-
onStartShouldSetResponder={[Function]}
|
|
267
|
-
style={
|
|
268
|
-
[
|
|
269
|
-
{
|
|
270
|
-
"alignItems": "center",
|
|
271
|
-
"flex": 1,
|
|
272
|
-
},
|
|
273
|
-
undefined,
|
|
274
|
-
]
|
|
275
|
-
}
|
|
276
|
-
>
|
|
277
|
-
<HeroIcon
|
|
278
|
-
name="bell-outlined"
|
|
279
|
-
style={
|
|
280
|
-
[
|
|
281
|
-
{
|
|
282
|
-
"color": "#001f23",
|
|
283
|
-
"fontSize": 24,
|
|
284
|
-
},
|
|
285
|
-
undefined,
|
|
286
|
-
]
|
|
287
|
-
}
|
|
288
|
-
testID="hero-icon-bell-outlined"
|
|
289
|
-
themeIntent="text"
|
|
290
|
-
themeSize="medium"
|
|
291
|
-
/>
|
|
292
|
-
<Text
|
|
293
|
-
allowFontScaling={false}
|
|
294
|
-
numberOfLines={1}
|
|
295
|
-
style={
|
|
296
|
-
[
|
|
297
|
-
{
|
|
298
|
-
"color": "#001f23",
|
|
299
|
-
"fontFamily": "BeVietnamPro-SemiBold",
|
|
300
|
-
"fontSize": 12,
|
|
301
|
-
"letterSpacing": 0.24,
|
|
302
|
-
"lineHeight": 16,
|
|
303
|
-
},
|
|
304
|
-
[
|
|
305
|
-
{
|
|
306
|
-
"marginTop": 4,
|
|
307
|
-
},
|
|
308
|
-
undefined,
|
|
309
|
-
],
|
|
310
|
-
]
|
|
311
|
-
}
|
|
312
|
-
themeFontWeight="semi-bold"
|
|
313
|
-
themeIntent="body"
|
|
314
|
-
>
|
|
315
|
-
Alerts
|
|
316
|
-
</Text>
|
|
317
|
-
</View>
|
|
318
|
-
<View
|
|
319
|
-
accessibilityState={
|
|
320
|
-
{
|
|
321
|
-
"busy": undefined,
|
|
322
|
-
"checked": undefined,
|
|
323
|
-
"disabled": undefined,
|
|
324
|
-
"expanded": undefined,
|
|
325
|
-
"selected": undefined,
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
accessible={true}
|
|
329
|
-
focusable={true}
|
|
330
|
-
onClick={[Function]}
|
|
331
|
-
onResponderGrant={[Function]}
|
|
332
|
-
onResponderMove={[Function]}
|
|
333
|
-
onResponderRelease={[Function]}
|
|
334
|
-
onResponderTerminate={[Function]}
|
|
335
|
-
onResponderTerminationRequest={[Function]}
|
|
336
|
-
onStartShouldSetResponder={[Function]}
|
|
337
|
-
style={
|
|
338
|
-
[
|
|
339
|
-
{
|
|
340
|
-
"alignItems": "center",
|
|
341
|
-
"flex": 1,
|
|
342
|
-
},
|
|
343
|
-
undefined,
|
|
344
|
-
]
|
|
345
|
-
}
|
|
346
|
-
>
|
|
347
|
-
<HeroIcon
|
|
348
|
-
name="user-outlined"
|
|
349
|
-
style={
|
|
350
|
-
[
|
|
351
|
-
{
|
|
352
|
-
"color": "#001f23",
|
|
353
|
-
"fontSize": 24,
|
|
354
|
-
},
|
|
355
|
-
undefined,
|
|
356
|
-
]
|
|
357
|
-
}
|
|
358
|
-
testID="hero-icon-user-outlined"
|
|
359
|
-
themeIntent="text"
|
|
360
|
-
themeSize="medium"
|
|
361
|
-
/>
|
|
362
|
-
<Text
|
|
363
|
-
allowFontScaling={false}
|
|
364
|
-
numberOfLines={1}
|
|
365
|
-
style={
|
|
366
|
-
[
|
|
367
|
-
{
|
|
368
|
-
"color": "#001f23",
|
|
369
|
-
"fontFamily": "BeVietnamPro-SemiBold",
|
|
370
|
-
"fontSize": 12,
|
|
371
|
-
"letterSpacing": 0.24,
|
|
372
|
-
"lineHeight": 16,
|
|
373
|
-
},
|
|
374
|
-
[
|
|
375
|
-
{
|
|
376
|
-
"marginTop": 4,
|
|
377
|
-
},
|
|
378
|
-
undefined,
|
|
379
|
-
],
|
|
380
|
-
]
|
|
381
|
-
}
|
|
382
|
-
themeFontWeight="semi-bold"
|
|
383
|
-
themeIntent="body"
|
|
384
|
-
>
|
|
385
|
-
Profile
|
|
386
|
-
</Text>
|
|
387
|
-
</View>
|
|
388
|
-
</View>
|
|
389
|
-
</View>
|
|
390
|
-
</View>
|
|
391
|
-
</RNCSafeAreaProvider>
|
|
392
|
-
<View
|
|
393
|
-
pointerEvents="box-none"
|
|
394
|
-
position="bottom"
|
|
395
|
-
style={
|
|
396
|
-
[
|
|
397
|
-
{
|
|
398
|
-
"bottom": 0,
|
|
399
|
-
"elevation": 9999,
|
|
400
|
-
"flexDirection": "column-reverse",
|
|
401
|
-
"left": 0,
|
|
402
|
-
"paddingHorizontal": 24,
|
|
403
|
-
"paddingVertical": 16,
|
|
404
|
-
"position": "absolute",
|
|
405
|
-
"right": 0,
|
|
406
|
-
"top": 0,
|
|
407
|
-
},
|
|
408
|
-
undefined,
|
|
409
|
-
]
|
|
410
|
-
}
|
|
411
|
-
/>
|
|
412
|
-
</View>
|
|
413
|
-
`;
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text } from 'react-native';
|
|
3
|
-
import { fireEvent } from '@testing-library/react-native';
|
|
4
|
-
import { SafeAreaProvider } from 'react-native-safe-area-context';
|
|
5
|
-
import type { ComponentProps } from 'react';
|
|
6
|
-
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
7
|
-
import BottomNavigation from '..';
|
|
8
|
-
import type { BottomNavigationTabType } from '..';
|
|
9
|
-
|
|
10
|
-
const TestComponent = (
|
|
11
|
-
props: Omit<
|
|
12
|
-
ComponentProps<typeof BottomNavigation>,
|
|
13
|
-
'selectedTabKey' | 'onTabPress' | 'tabs'
|
|
14
|
-
>
|
|
15
|
-
) => {
|
|
16
|
-
const [selectedTabKey, setSelectedTabKey] = React.useState('home');
|
|
17
|
-
const tabs: BottomNavigationTabType[] = [
|
|
18
|
-
{
|
|
19
|
-
key: 'home',
|
|
20
|
-
title: 'Home',
|
|
21
|
-
icon: 'home',
|
|
22
|
-
component: <Text>Home Screen</Text>,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
key: 'feed',
|
|
26
|
-
title: 'Feed',
|
|
27
|
-
icon: 'speaker-outlined',
|
|
28
|
-
component: <Text>Feed Screen</Text>,
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
key: 'alerts',
|
|
32
|
-
title: 'Alerts',
|
|
33
|
-
icon: 'bell-outlined',
|
|
34
|
-
component: <Text>Alerts Screen</Text>,
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
key: 'profile',
|
|
38
|
-
title: 'Profile',
|
|
39
|
-
icon: 'user-outlined',
|
|
40
|
-
component: <Text>Profile Screen</Text>,
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<SafeAreaProvider
|
|
46
|
-
initialMetrics={{
|
|
47
|
-
frame: { x: 0, y: 0, width: 0, height: 0 },
|
|
48
|
-
insets: { top: 0, left: 0, right: 0, bottom: 0 },
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
<BottomNavigation
|
|
52
|
-
{...props}
|
|
53
|
-
tabs={tabs}
|
|
54
|
-
selectedTabKey={selectedTabKey}
|
|
55
|
-
onTabPress={(newTabKey) => setSelectedTabKey(newTabKey)}
|
|
56
|
-
/>
|
|
57
|
-
</SafeAreaProvider>
|
|
58
|
-
);
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
describe('BottomNavigation', () => {
|
|
62
|
-
it('renders correctly', () => {
|
|
63
|
-
const { getByText, toJSON } = renderWithTheme(<TestComponent />);
|
|
64
|
-
|
|
65
|
-
expect(toJSON()).toMatchSnapshot();
|
|
66
|
-
expect(getByText('Home')).toBeDefined();
|
|
67
|
-
fireEvent.press(getByText('Feed'));
|
|
68
|
-
fireEvent.press(getByText('Alerts'));
|
|
69
|
-
fireEvent.press(getByText('Profile'));
|
|
70
|
-
|
|
71
|
-
// All screens are rendered and component is not unmounted when switching screen.
|
|
72
|
-
expect(getByText('Home Screen')).toBeDefined();
|
|
73
|
-
expect(getByText('Feed Screen')).toBeDefined();
|
|
74
|
-
expect(getByText('Alerts Screen')).toBeDefined();
|
|
75
|
-
expect(getByText('Profile Screen')).toBeDefined();
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('renders correctly with renderActiveTabOnly is true', () => {
|
|
79
|
-
const { getByText, queryByText, getByTestId } = renderWithTheme(
|
|
80
|
-
<TestComponent renderActiveTabOnly />
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
// Can switch tab by clicking icon.
|
|
84
|
-
expect(getByText('Home Screen')).toBeDefined();
|
|
85
|
-
fireEvent.press(getByTestId('hero-icon-speaker-outlined'));
|
|
86
|
-
expect(getByText('Feed Screen')).toBeDefined();
|
|
87
|
-
fireEvent.press(getByTestId('hero-icon-bell-outlined'));
|
|
88
|
-
expect(getByText('Alerts Screen')).toBeDefined();
|
|
89
|
-
fireEvent.press(getByTestId('hero-icon-user-outlined'));
|
|
90
|
-
expect(getByText('Profile Screen')).toBeDefined();
|
|
91
|
-
|
|
92
|
-
// Only render selected screen, others are unmounted.
|
|
93
|
-
expect(queryByText('Home Screen')).toBeNull();
|
|
94
|
-
expect(queryByText('Feed Screen')).toBeNull();
|
|
95
|
-
expect(queryByText('Alerts Screen')).toBeNull();
|
|
96
|
-
});
|
|
97
|
-
});
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { TouchableWithoutFeedback } from 'react-native';
|
|
3
|
-
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
-
import type { ReactNode } from 'react';
|
|
5
|
-
import type { StyleProp, ViewStyle, ViewProps } from 'react-native';
|
|
6
|
-
import Icon from '../Icon';
|
|
7
|
-
import { isHeroIcon } from '../Icon/utils';
|
|
8
|
-
import {
|
|
9
|
-
BottomBar,
|
|
10
|
-
BottomBarItem,
|
|
11
|
-
BottomBarWrapper,
|
|
12
|
-
BottomNavigationContainer,
|
|
13
|
-
BottomNavigationTab,
|
|
14
|
-
ContentWrapper,
|
|
15
|
-
StyledBottomBarText,
|
|
16
|
-
} from './StyledBottomNavigation';
|
|
17
|
-
import { isIOS } from '../../utils/helpers';
|
|
18
|
-
import type { IconName } from '../Icon';
|
|
19
|
-
import { useDeprecation } from '../../utils/hooks';
|
|
20
|
-
|
|
21
|
-
export type BottomNavigationTabType = {
|
|
22
|
-
key: string;
|
|
23
|
-
title?: string;
|
|
24
|
-
icon: IconName;
|
|
25
|
-
component: ReactNode;
|
|
26
|
-
testID?: string;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
interface BottomNavigationProps extends ViewProps {
|
|
30
|
-
/**
|
|
31
|
-
* Callback which is called on tab press, receiving key of upcoming active Tab.
|
|
32
|
-
*/
|
|
33
|
-
onTabPress: (key: string) => void;
|
|
34
|
-
/**
|
|
35
|
-
* Whether inactive tabs should be removed and unmounted in React.
|
|
36
|
-
* Defaults to `false`.
|
|
37
|
-
*/
|
|
38
|
-
renderActiveTabOnly?: boolean;
|
|
39
|
-
/**
|
|
40
|
-
* Current selected tab key.
|
|
41
|
-
*/
|
|
42
|
-
selectedTabKey: string;
|
|
43
|
-
/**
|
|
44
|
-
* List of Tabs to be rendered. Each Tab must have an unique key.
|
|
45
|
-
*/
|
|
46
|
-
tabs: {
|
|
47
|
-
key: string;
|
|
48
|
-
title?: string;
|
|
49
|
-
icon: IconName;
|
|
50
|
-
component: ReactNode;
|
|
51
|
-
testID?: string;
|
|
52
|
-
}[];
|
|
53
|
-
/**
|
|
54
|
-
* Additional style.
|
|
55
|
-
*/
|
|
56
|
-
style?: StyleProp<ViewStyle>;
|
|
57
|
-
/**
|
|
58
|
-
* Testing id of the component.
|
|
59
|
-
*/
|
|
60
|
-
testID?: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
const getInactiveIcon = (icon: IconName): IconName => {
|
|
64
|
-
const inactiveIcon = `${icon}-outlined`;
|
|
65
|
-
return isHeroIcon(inactiveIcon) ? inactiveIcon : icon;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const BottomNavigation = ({
|
|
69
|
-
onTabPress,
|
|
70
|
-
renderActiveTabOnly = false,
|
|
71
|
-
selectedTabKey,
|
|
72
|
-
tabs,
|
|
73
|
-
...nativeProps
|
|
74
|
-
}: BottomNavigationProps): JSX.Element => {
|
|
75
|
-
useDeprecation(
|
|
76
|
-
'BottomNavigation is deprecated and will be removed in the next major release. Please remove it.'
|
|
77
|
-
);
|
|
78
|
-
const insets = useSafeAreaInsets();
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* List of loaded tabs, tabs will be loaded when navigated to.
|
|
82
|
-
*/
|
|
83
|
-
const [loaded, setLoaded] = React.useState([selectedTabKey]);
|
|
84
|
-
|
|
85
|
-
if (!loaded.includes(selectedTabKey)) {
|
|
86
|
-
// Set the current tab to be loaded if it was not loaded before
|
|
87
|
-
setLoaded((loadedState) => [...loadedState, selectedTabKey]);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
return (
|
|
91
|
-
<BottomNavigationContainer {...nativeProps}>
|
|
92
|
-
<ContentWrapper>
|
|
93
|
-
{tabs.map((tab) => {
|
|
94
|
-
const { key, component, testID } = tab;
|
|
95
|
-
const active = selectedTabKey === key;
|
|
96
|
-
|
|
97
|
-
if (renderActiveTabOnly && !active) {
|
|
98
|
-
return null;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
if (!loaded.includes(key)) {
|
|
102
|
-
// Don't render a screen if we've never navigated to it
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<BottomNavigationTab
|
|
108
|
-
key={key}
|
|
109
|
-
testID={testID ? `route-screen-${testID}` : undefined}
|
|
110
|
-
pointerEvents={active ? 'auto' : 'none'}
|
|
111
|
-
accessibilityElementsHidden={!active}
|
|
112
|
-
importantForAccessibility={
|
|
113
|
-
active ? 'auto' : 'no-hide-descendants'
|
|
114
|
-
}
|
|
115
|
-
collapsable={false}
|
|
116
|
-
removeClippedSubviews={
|
|
117
|
-
// On iOS, set removeClippedSubviews to true only when not focused
|
|
118
|
-
// This is an workaround for a bug where the clipped view never re-appears.
|
|
119
|
-
isIOS ? selectedTabKey !== key : true
|
|
120
|
-
}
|
|
121
|
-
themeVisibility={active}
|
|
122
|
-
>
|
|
123
|
-
{component}
|
|
124
|
-
</BottomNavigationTab>
|
|
125
|
-
);
|
|
126
|
-
})}
|
|
127
|
-
</ContentWrapper>
|
|
128
|
-
<BottomBarWrapper themeInsets={insets}>
|
|
129
|
-
<BottomBar>
|
|
130
|
-
{tabs.map((tab) => {
|
|
131
|
-
const { key, icon, title, testID } = tab;
|
|
132
|
-
const active = selectedTabKey === key;
|
|
133
|
-
const inactiveIcon = getInactiveIcon(icon);
|
|
134
|
-
|
|
135
|
-
return (
|
|
136
|
-
<TouchableWithoutFeedback
|
|
137
|
-
key={key}
|
|
138
|
-
onPress={() => onTabPress(key)}
|
|
139
|
-
testID={testID}
|
|
140
|
-
>
|
|
141
|
-
<BottomBarItem>
|
|
142
|
-
<Icon
|
|
143
|
-
icon={active ? icon : inactiveIcon}
|
|
144
|
-
intent={active ? 'primary' : 'text'}
|
|
145
|
-
testID={`hero-icon-${icon}`}
|
|
146
|
-
/>
|
|
147
|
-
{!!title && (
|
|
148
|
-
<StyledBottomBarText
|
|
149
|
-
fontWeight="semi-bold"
|
|
150
|
-
intent={active ? 'primary' : 'body'}
|
|
151
|
-
numberOfLines={1}
|
|
152
|
-
>
|
|
153
|
-
{title}
|
|
154
|
-
</StyledBottomBarText>
|
|
155
|
-
)}
|
|
156
|
-
</BottomBarItem>
|
|
157
|
-
</TouchableWithoutFeedback>
|
|
158
|
-
);
|
|
159
|
-
})}
|
|
160
|
-
</BottomBar>
|
|
161
|
-
</BottomBarWrapper>
|
|
162
|
-
</BottomNavigationContainer>
|
|
163
|
-
);
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export default BottomNavigation;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import type { GlobalTheme } from '../global';
|
|
2
|
-
|
|
3
|
-
const getBottomNavigationTheme = (theme: GlobalTheme) => {
|
|
4
|
-
const colors = {
|
|
5
|
-
shadow: theme.colors.primary,
|
|
6
|
-
background: theme.colors.defaultGlobalSurface,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const sizes = {
|
|
10
|
-
height: theme.sizes['6xlarge'],
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const shadows = {
|
|
14
|
-
offset: { width: 0, height: 3 },
|
|
15
|
-
opacity: 0.27,
|
|
16
|
-
radius: 4.65,
|
|
17
|
-
elevation: 10,
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const space = {
|
|
21
|
-
titleMarginTop: theme.space.xsmall,
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
return { colors, shadows, sizes, space };
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
export default getBottomNavigationTheme;
|