@hero-design/rn 7.2.0 → 7.3.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/.expo/README.md +15 -0
- package/.expo/packager-info.json +10 -0
- package/.expo/prebuild/cached-packages.json +4 -0
- package/.expo/settings.json +10 -0
- package/.expo/xcodebuild-error.log +2 -0
- package/.expo/xcodebuild.log +11199 -0
- package/.turbo/turbo-build.log +8 -0
- package/.turbo/turbo-build:types.log +2 -0
- package/.turbo/turbo-publish:npm.log +0 -0
- package/.turbo/turbo-test.log +131 -0
- package/.turbo/turbo-type-check.log +7 -0
- package/es/index.js +2406 -469
- package/jest.config.js +1 -1
- package/lib/index.js +2423 -481
- package/package.json +4 -38
- package/playground/components/Avatar.tsx +102 -0
- package/playground/components/Badge.tsx +146 -9
- package/playground/components/Button.tsx +138 -35
- package/playground/components/Card.tsx +40 -14
- package/playground/components/Collapse.tsx +99 -0
- package/playground/components/Drawer.tsx +32 -0
- package/playground/components/FAB.tsx +15 -0
- package/playground/components/IconButton.tsx +67 -0
- package/playground/components/Progress.tsx +95 -0
- package/playground/components/Tabs.tsx +106 -14
- package/playground/components/Tag.tsx +45 -0
- package/playground/index.tsx +18 -0
- package/src/components/Avatar/StyledAvatar.tsx +61 -0
- package/src/components/Avatar/__tests__/StyledAvatar.spec.tsx +48 -0
- package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +87 -0
- package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +88 -0
- package/src/components/Avatar/__tests__/index.spec.tsx +26 -0
- package/src/components/Avatar/index.tsx +71 -0
- package/src/components/Badge/Status.tsx +77 -0
- package/src/components/Badge/StyledBadge.tsx +38 -26
- package/src/components/Badge/__tests__/Badge.spec.tsx +16 -0
- package/src/components/Badge/__tests__/Status.spec.tsx +27 -0
- package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +133 -52
- package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +89 -0
- package/src/components/Badge/index.tsx +77 -19
- package/src/components/Button/Button.tsx +163 -0
- package/src/components/Button/LoadingIndicator/StyledLoadingIndicator.tsx +58 -0
- package/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.tsx +20 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +101 -0
- package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +606 -0
- package/src/components/Button/LoadingIndicator/__tests__/index.spec.tsx +24 -0
- package/src/components/Button/LoadingIndicator/index.tsx +140 -0
- package/src/components/Button/StyledButton.tsx +254 -0
- package/src/components/Button/__tests__/Button.spec.tsx +86 -0
- package/src/components/Button/__tests__/{index.spec.tsx → IconButton.spec.tsx} +0 -0
- package/src/components/Button/__tests__/StyledButton.spec.tsx +154 -0
- package/src/components/Button/__tests__/__snapshots__/{index.spec.tsx.snap → IconButton.spec.tsx.snap} +0 -0
- package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +895 -0
- package/src/components/Button/index.tsx +10 -2
- package/src/components/Card/StyledCard.tsx +27 -5
- package/src/components/Card/__tests__/StyledCard.spec.tsx +15 -3
- package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +34 -2
- package/src/components/Card/__tests__/index.spec.tsx +16 -21
- package/src/components/Card/index.tsx +15 -2
- package/src/components/Collapse/StyledCollapse.tsx +15 -0
- package/src/components/Collapse/__tests__/StyledCollapse.spec.tsx +26 -0
- package/src/components/Collapse/__tests__/__snapshots__/StyledCollapse.spec.tsx.snap +37 -0
- package/src/components/Collapse/__tests__/__snapshots__/index.spec.tsx.snap +84 -0
- package/src/components/Collapse/__tests__/index.spec.tsx +42 -0
- package/src/components/Collapse/index.tsx +109 -0
- package/src/components/Divider/index.tsx +1 -1
- package/src/components/Drawer/StyledDrawer.tsx +39 -0
- package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +244 -0
- package/src/components/Drawer/__tests__/index.spec.tsx +37 -0
- package/src/components/Drawer/index.tsx +93 -0
- package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +78 -62
- package/src/components/FAB/ActionGroup/__tests__/index.spec.tsx +2 -0
- package/src/components/FAB/ActionGroup/index.tsx +13 -1
- package/src/components/FAB/FAB.tsx +63 -13
- package/src/components/FAB/StyledFAB.tsx +25 -6
- package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +6 -2
- package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +7 -3
- package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +88 -6
- package/src/components/FAB/__tests__/index.spec.tsx +16 -0
- package/src/components/Progress/ProgressBar.tsx +73 -0
- package/src/components/Progress/ProgressCircle.tsx +165 -0
- package/src/components/Progress/StyledProgressBar.tsx +21 -0
- package/src/components/Progress/StyledProgressCircle.tsx +66 -0
- package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +641 -0
- package/src/components/Progress/__tests__/index.spec.js +46 -0
- package/src/components/Progress/index.tsx +6 -0
- package/src/components/Progress/types.ts +1 -0
- package/src/components/Tabs/ActiveTabIndicator.tsx +37 -0
- package/src/components/Tabs/ScrollableTabs.tsx +216 -0
- package/src/components/Tabs/StyledScrollableTabs.tsx +60 -0
- package/src/components/Tabs/StyledTabs.tsx +30 -44
- package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +84 -0
- package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +591 -0
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +317 -224
- package/src/components/Tabs/__tests__/index.spec.tsx +22 -21
- package/src/components/Tabs/index.tsx +155 -114
- package/src/components/Tabs/utils.ts +13 -0
- package/src/components/Tag/StyledTag.tsx +35 -0
- package/src/components/Tag/__tests__/Tag.spec.tsx +41 -0
- package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +153 -0
- package/src/components/Tag/index.tsx +41 -0
- package/src/components/Typography/Text/index.tsx +1 -1
- package/src/index.ts +10 -0
- package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +181 -22
- package/src/theme/components/avatar.ts +40 -0
- package/src/theme/components/badge.ts +14 -16
- package/src/theme/components/button.ts +57 -0
- package/src/theme/components/card.ts +5 -5
- package/src/theme/components/drawer.ts +24 -0
- package/src/theme/components/fab.ts +9 -2
- package/src/theme/components/progress.ts +27 -0
- package/src/theme/components/tabs.ts +22 -7
- package/src/theme/components/tag.ts +39 -0
- package/src/theme/global/borders.ts +13 -1
- package/src/theme/global/colors.ts +7 -2
- package/src/theme/global/index.ts +3 -1
- package/src/theme/global/scale.ts +3 -0
- package/src/theme/index.ts +15 -0
- package/src/utils/hooks.ts +10 -0
- package/testUtils/setup.tsx +43 -0
- package/types/playground/components/Avatar.d.ts +2 -0
- package/types/playground/components/Badge.d.ts +0 -0
- package/types/playground/components/BottomNavigation.d.ts +0 -0
- package/types/playground/components/Button.d.ts +0 -0
- package/types/playground/components/Card.d.ts +0 -0
- package/types/playground/components/Collapse.d.ts +2 -0
- package/types/playground/components/Divider.d.ts +0 -0
- package/types/playground/components/Drawer.d.ts +2 -0
- package/types/playground/components/FAB.d.ts +0 -0
- package/types/playground/components/Icon.d.ts +0 -0
- package/types/playground/components/IconButton.d.ts +2 -0
- package/types/playground/components/Progress.d.ts +2 -0
- package/types/playground/components/Tabs.d.ts +0 -0
- package/types/playground/components/Tag.d.ts +2 -0
- package/types/playground/components/Typography.d.ts +0 -0
- package/types/playground/index.d.ts +0 -0
- package/types/src/components/Avatar/StyledAvatar.d.ts +46 -0
- package/types/src/components/Avatar/__tests__/StyledAvatar.spec.d.ts +1 -0
- package/types/src/components/Avatar/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Avatar/index.d.ts +25 -0
- package/types/src/components/Badge/Status.d.ts +24 -0
- package/types/src/components/Badge/StyledBadge.d.ts +17 -9
- package/types/src/components/Badge/__tests__/Badge.spec.d.ts +0 -0
- package/types/src/components/Badge/__tests__/Status.spec.d.ts +1 -0
- package/types/src/components/Badge/index.d.ts +17 -7
- package/types/src/components/BottomNavigation/StyledBottomNavigation.d.ts +0 -0
- package/types/src/components/BottomNavigation/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/BottomNavigation/index.d.ts +0 -0
- package/types/src/components/Button/Button.d.ts +57 -0
- package/types/src/components/Button/IconButton.d.ts +0 -0
- package/types/src/components/Button/LoadingIndicator/StyledLoadingIndicator.d.ts +20 -0
- package/types/src/components/Button/LoadingIndicator/__tests__/StyledLoadingIndicator.spec.d.ts +1 -0
- package/types/src/components/Button/LoadingIndicator/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Button/LoadingIndicator/index.d.ts +26 -0
- package/types/src/components/Button/StyledButton.d.ts +40 -0
- package/types/src/components/Button/__tests__/Button.spec.d.ts +1 -0
- package/types/src/components/Button/__tests__/IconButton.spec.d.ts +1 -0
- package/types/src/components/Button/__tests__/StyledButton.spec.d.ts +1 -0
- package/types/src/components/Button/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Button/index.d.ts +8 -4
- package/types/src/components/Card/StyledCard.d.ts +9 -1
- package/types/src/components/Card/__tests__/StyledCard.spec.d.ts +0 -0
- package/types/src/components/Card/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Card/index.d.ts +5 -1
- package/types/src/components/Collapse/StyledCollapse.d.ts +15 -0
- package/types/src/components/Collapse/__tests__/StyledCollapse.spec.d.ts +1 -0
- package/types/src/components/Collapse/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Collapse/index.d.ts +23 -0
- package/types/src/components/Divider/StyledDivider.d.ts +0 -0
- package/types/src/components/Divider/__tests__/StyledDivider.spec.d.ts +0 -0
- package/types/src/components/Divider/index.d.ts +0 -0
- package/types/src/components/Drawer/StyledDrawer.d.ts +25 -0
- package/types/src/components/Drawer/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Drawer/index.d.ts +25 -0
- package/types/src/components/FAB/ActionGroup/ActionItem.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/StyledActionGroup.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/StyledActionItem.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/FAB/ActionGroup/index.d.ts +8 -1
- package/types/src/components/FAB/AnimatedFABIcon.d.ts +0 -0
- package/types/src/components/FAB/FAB.d.ts +5 -1
- package/types/src/components/FAB/StyledFAB.d.ts +8 -2
- package/types/src/components/FAB/__tests__/AnimatedFABIcon.spec.d.ts +0 -0
- package/types/src/components/FAB/__tests__/StyledFAB.spec.d.ts +0 -0
- package/types/src/components/FAB/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/FAB/index.d.ts +2 -2
- package/types/src/components/Icon/HeroIcon/index.d.ts +0 -0
- package/types/src/components/Icon/IconList.d.ts +0 -0
- package/types/src/components/Icon/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Icon/index.d.ts +0 -0
- package/types/src/components/Icon/utils.d.ts +1 -1
- package/types/src/components/Progress/ProgressBar.d.ts +18 -0
- package/types/src/components/Progress/ProgressCircle.d.ts +18 -0
- package/types/src/components/Progress/StyledProgressBar.d.ts +18 -0
- package/types/src/components/Progress/StyledProgressCircle.d.ts +38 -0
- package/types/src/components/Progress/__tests__/index.spec.d.ts +1 -0
- package/types/src/components/Progress/index.d.ts +5 -0
- package/types/src/components/Progress/types.d.ts +1 -0
- package/types/src/components/Tabs/ActiveTabIndicator.d.ts +8 -0
- package/types/src/components/Tabs/ScrollableTabs.d.ts +3 -0
- package/types/src/components/Tabs/StyledScrollableTabs.d.ts +61 -0
- package/types/src/components/Tabs/StyledTabs.d.ts +22 -22
- package/types/src/components/Tabs/__tests__/ScrollableTabs.spec.d.ts +1 -0
- package/types/src/components/Tabs/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Tabs/index.d.ts +28 -19
- package/types/src/components/Tabs/utils.d.ts +2 -0
- package/types/src/components/Tag/StyledTag.d.ts +20 -0
- package/types/src/components/Tag/__tests__/Tag.spec.d.ts +1 -0
- package/types/src/components/Tag/index.d.ts +21 -0
- package/types/src/components/Typography/Text/StyledText.d.ts +0 -0
- package/types/src/components/Typography/Text/__tests__/StyledText.spec.d.ts +0 -0
- package/types/src/components/Typography/Text/__tests__/index.spec.d.ts +0 -0
- package/types/src/components/Typography/Text/index.d.ts +0 -0
- package/types/src/components/Typography/index.d.ts +0 -0
- package/types/src/index.d.ts +6 -1
- package/types/src/testHelpers/renderWithTheme.d.ts +0 -0
- package/types/src/theme/__tests__/index.spec.d.ts +0 -0
- package/types/src/theme/components/avatar.d.ts +32 -0
- package/types/src/theme/components/badge.d.ts +12 -13
- package/types/src/theme/components/bottomNavigation.d.ts +0 -0
- package/types/src/theme/components/button.d.ts +37 -0
- package/types/src/theme/components/card.d.ts +3 -3
- package/types/src/theme/components/divider.d.ts +0 -0
- package/types/src/theme/components/drawer.d.ts +21 -0
- package/types/src/theme/components/fab.d.ts +8 -1
- package/types/src/theme/components/icon.d.ts +0 -0
- package/types/src/theme/components/progress.d.ts +21 -0
- package/types/src/theme/components/tabs.d.ts +14 -2
- package/types/src/theme/components/tag.d.ts +30 -0
- package/types/src/theme/components/typography.d.ts +0 -0
- package/types/src/theme/global/borders.d.ts +7 -1
- package/types/src/theme/global/colors.d.ts +6 -1
- package/types/src/theme/global/index.d.ts +7 -1
- package/types/src/theme/global/scale.d.ts +1 -0
- package/types/src/theme/global/space.d.ts +0 -0
- package/types/src/theme/global/typography.d.ts +0 -0
- package/types/src/theme/index.d.ts +10 -0
- package/types/src/types.d.ts +0 -0
- package/types/src/utils/__tests__/scale.spec.d.ts +0 -0
- package/types/src/utils/helpers.d.ts +0 -0
- package/types/src/utils/hooks.d.ts +1 -0
- package/types/src/utils/scale.d.ts +0 -0
- package/src/components/Card/__tests__/__snapshots__/index.spec.tsx.snap +0 -34
- package/testUtils/setup.ts +0 -18
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Drawer renders correctly in invisible state 1`] = `
|
|
4
|
+
<View
|
|
5
|
+
enableShadow={false}
|
|
6
|
+
pointerEvents="box-none"
|
|
7
|
+
style={
|
|
8
|
+
Array [
|
|
9
|
+
Object {
|
|
10
|
+
"bottom": 0,
|
|
11
|
+
"elevation": 9999,
|
|
12
|
+
"left": 0,
|
|
13
|
+
"overflow": "hidden",
|
|
14
|
+
"position": "absolute",
|
|
15
|
+
"right": 0,
|
|
16
|
+
"shadowColor": "transparent",
|
|
17
|
+
"shadowOffset": Object {
|
|
18
|
+
"height": 3,
|
|
19
|
+
"width": 0,
|
|
20
|
+
},
|
|
21
|
+
"shadowOpacity": 0.27,
|
|
22
|
+
"shadowRadius": 4.65,
|
|
23
|
+
"top": 0,
|
|
24
|
+
"zIndex": 9999,
|
|
25
|
+
},
|
|
26
|
+
undefined,
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
>
|
|
30
|
+
<View
|
|
31
|
+
accessible={true}
|
|
32
|
+
collapsable={false}
|
|
33
|
+
focusable={true}
|
|
34
|
+
nativeID="animatedComponent"
|
|
35
|
+
onBlur={[Function]}
|
|
36
|
+
onClick={[Function]}
|
|
37
|
+
onFocus={[Function]}
|
|
38
|
+
onResponderGrant={[Function]}
|
|
39
|
+
onResponderMove={[Function]}
|
|
40
|
+
onResponderRelease={[Function]}
|
|
41
|
+
onResponderTerminate={[Function]}
|
|
42
|
+
onResponderTerminationRequest={[Function]}
|
|
43
|
+
onStartShouldSetResponder={[Function]}
|
|
44
|
+
pointerEvents="box-none"
|
|
45
|
+
style={
|
|
46
|
+
Object {
|
|
47
|
+
"backgroundColor": "#292a2b",
|
|
48
|
+
"bottom": 0,
|
|
49
|
+
"left": 0,
|
|
50
|
+
"opacity": 0,
|
|
51
|
+
"position": "absolute",
|
|
52
|
+
"right": 0,
|
|
53
|
+
"top": 0,
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/>
|
|
57
|
+
<View
|
|
58
|
+
collapsable={false}
|
|
59
|
+
enableShadow={false}
|
|
60
|
+
nativeID="animatedComponent"
|
|
61
|
+
onLayout={[Function]}
|
|
62
|
+
style={
|
|
63
|
+
Object {
|
|
64
|
+
"backgroundColor": "#ffffff",
|
|
65
|
+
"borderBottomLeftRadius": 16,
|
|
66
|
+
"borderBottomRightRadius": 16,
|
|
67
|
+
"elevation": undefined,
|
|
68
|
+
"overflow": "hidden",
|
|
69
|
+
"transform": Array [
|
|
70
|
+
Object {
|
|
71
|
+
"translateY": -0,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
>
|
|
77
|
+
<Text>
|
|
78
|
+
Drawer Content
|
|
79
|
+
</Text>
|
|
80
|
+
</View>
|
|
81
|
+
</View>
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
exports[`Drawer renders correctly in visible state 1`] = `
|
|
85
|
+
<View
|
|
86
|
+
enableShadow={false}
|
|
87
|
+
pointerEvents="box-none"
|
|
88
|
+
style={
|
|
89
|
+
Array [
|
|
90
|
+
Object {
|
|
91
|
+
"bottom": 0,
|
|
92
|
+
"elevation": 9999,
|
|
93
|
+
"left": 0,
|
|
94
|
+
"overflow": "hidden",
|
|
95
|
+
"position": "absolute",
|
|
96
|
+
"right": 0,
|
|
97
|
+
"shadowColor": "transparent",
|
|
98
|
+
"shadowOffset": Object {
|
|
99
|
+
"height": 3,
|
|
100
|
+
"width": 0,
|
|
101
|
+
},
|
|
102
|
+
"shadowOpacity": 0.27,
|
|
103
|
+
"shadowRadius": 4.65,
|
|
104
|
+
"top": 0,
|
|
105
|
+
"zIndex": 9999,
|
|
106
|
+
},
|
|
107
|
+
undefined,
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
>
|
|
111
|
+
<View
|
|
112
|
+
accessible={true}
|
|
113
|
+
collapsable={false}
|
|
114
|
+
focusable={true}
|
|
115
|
+
nativeID="animatedComponent"
|
|
116
|
+
onBlur={[Function]}
|
|
117
|
+
onClick={[Function]}
|
|
118
|
+
onFocus={[Function]}
|
|
119
|
+
onResponderGrant={[Function]}
|
|
120
|
+
onResponderMove={[Function]}
|
|
121
|
+
onResponderRelease={[Function]}
|
|
122
|
+
onResponderTerminate={[Function]}
|
|
123
|
+
onResponderTerminationRequest={[Function]}
|
|
124
|
+
onStartShouldSetResponder={[Function]}
|
|
125
|
+
pointerEvents="auto"
|
|
126
|
+
style={
|
|
127
|
+
Object {
|
|
128
|
+
"backgroundColor": "#292a2b",
|
|
129
|
+
"bottom": 0,
|
|
130
|
+
"left": 0,
|
|
131
|
+
"opacity": 0.35,
|
|
132
|
+
"position": "absolute",
|
|
133
|
+
"right": 0,
|
|
134
|
+
"top": 0,
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/>
|
|
138
|
+
<View
|
|
139
|
+
collapsable={false}
|
|
140
|
+
enableShadow={false}
|
|
141
|
+
nativeID="animatedComponent"
|
|
142
|
+
onLayout={[Function]}
|
|
143
|
+
style={
|
|
144
|
+
Object {
|
|
145
|
+
"backgroundColor": "#ffffff",
|
|
146
|
+
"borderBottomLeftRadius": 16,
|
|
147
|
+
"borderBottomRightRadius": 16,
|
|
148
|
+
"elevation": undefined,
|
|
149
|
+
"overflow": "hidden",
|
|
150
|
+
"transform": Array [
|
|
151
|
+
Object {
|
|
152
|
+
"translateY": -0,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
>
|
|
158
|
+
<Text>
|
|
159
|
+
Drawer Content
|
|
160
|
+
</Text>
|
|
161
|
+
</View>
|
|
162
|
+
</View>
|
|
163
|
+
`;
|
|
164
|
+
|
|
165
|
+
exports[`Drawer renders correctly with no backdrop 1`] = `
|
|
166
|
+
<View
|
|
167
|
+
enableShadow={false}
|
|
168
|
+
pointerEvents="box-none"
|
|
169
|
+
style={
|
|
170
|
+
Array [
|
|
171
|
+
Object {
|
|
172
|
+
"bottom": 0,
|
|
173
|
+
"elevation": 9999,
|
|
174
|
+
"left": 0,
|
|
175
|
+
"overflow": "hidden",
|
|
176
|
+
"position": "absolute",
|
|
177
|
+
"right": 0,
|
|
178
|
+
"shadowColor": "transparent",
|
|
179
|
+
"shadowOffset": Object {
|
|
180
|
+
"height": 3,
|
|
181
|
+
"width": 0,
|
|
182
|
+
},
|
|
183
|
+
"shadowOpacity": 0.27,
|
|
184
|
+
"shadowRadius": 4.65,
|
|
185
|
+
"top": 0,
|
|
186
|
+
"zIndex": 9999,
|
|
187
|
+
},
|
|
188
|
+
undefined,
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
>
|
|
192
|
+
<View
|
|
193
|
+
accessible={true}
|
|
194
|
+
collapsable={false}
|
|
195
|
+
focusable={true}
|
|
196
|
+
nativeID="animatedComponent"
|
|
197
|
+
onBlur={[Function]}
|
|
198
|
+
onClick={[Function]}
|
|
199
|
+
onFocus={[Function]}
|
|
200
|
+
onResponderGrant={[Function]}
|
|
201
|
+
onResponderMove={[Function]}
|
|
202
|
+
onResponderRelease={[Function]}
|
|
203
|
+
onResponderTerminate={[Function]}
|
|
204
|
+
onResponderTerminationRequest={[Function]}
|
|
205
|
+
onStartShouldSetResponder={[Function]}
|
|
206
|
+
pointerEvents="box-none"
|
|
207
|
+
style={
|
|
208
|
+
Object {
|
|
209
|
+
"backgroundColor": "#292a2b",
|
|
210
|
+
"bottom": 0,
|
|
211
|
+
"left": 0,
|
|
212
|
+
"opacity": 0,
|
|
213
|
+
"position": "absolute",
|
|
214
|
+
"right": 0,
|
|
215
|
+
"top": 0,
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/>
|
|
219
|
+
<View
|
|
220
|
+
collapsable={false}
|
|
221
|
+
enableShadow={false}
|
|
222
|
+
nativeID="animatedComponent"
|
|
223
|
+
onLayout={[Function]}
|
|
224
|
+
style={
|
|
225
|
+
Object {
|
|
226
|
+
"backgroundColor": "#ffffff",
|
|
227
|
+
"borderBottomLeftRadius": 16,
|
|
228
|
+
"borderBottomRightRadius": 16,
|
|
229
|
+
"elevation": undefined,
|
|
230
|
+
"overflow": "hidden",
|
|
231
|
+
"transform": Array [
|
|
232
|
+
Object {
|
|
233
|
+
"translateY": -0,
|
|
234
|
+
},
|
|
235
|
+
],
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
>
|
|
239
|
+
<Text>
|
|
240
|
+
Drawer Content
|
|
241
|
+
</Text>
|
|
242
|
+
</View>
|
|
243
|
+
</View>
|
|
244
|
+
`;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import renderWithTheme from '../../../testHelpers/renderWithTheme';
|
|
5
|
+
import Drawer from '..';
|
|
6
|
+
|
|
7
|
+
describe('Drawer', () => {
|
|
8
|
+
it('renders correctly in visible state', () => {
|
|
9
|
+
const { toJSON } = renderWithTheme(
|
|
10
|
+
<Drawer visible>
|
|
11
|
+
<Text>Drawer Content</Text>
|
|
12
|
+
</Drawer>
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
expect(toJSON()).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it('renders correctly in invisible state', () => {
|
|
19
|
+
const { toJSON } = renderWithTheme(
|
|
20
|
+
<Drawer visible={false}>
|
|
21
|
+
<Text>Drawer Content</Text>
|
|
22
|
+
</Drawer>
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
expect(toJSON()).toMatchSnapshot();
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('renders correctly with no backdrop', () => {
|
|
29
|
+
const { toJSON } = renderWithTheme(
|
|
30
|
+
<Drawer hasBackdrop={false} visible={false}>
|
|
31
|
+
<Text>Drawer Content</Text>
|
|
32
|
+
</Drawer>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
expect(toJSON()).toMatchSnapshot();
|
|
36
|
+
});
|
|
37
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import React, { ReactNode, useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { Animated, Easing } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
StyledBackdrop,
|
|
6
|
+
StyledContainer,
|
|
7
|
+
StyledDrawerContainer,
|
|
8
|
+
} from './StyledDrawer';
|
|
9
|
+
|
|
10
|
+
interface DrawerProps {
|
|
11
|
+
/**
|
|
12
|
+
* Drawer's visibility.
|
|
13
|
+
*/
|
|
14
|
+
visible: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Drawer's content.
|
|
17
|
+
*/
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Enable the drawer's backdrop.
|
|
21
|
+
*/
|
|
22
|
+
hasBackdrop?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Callback when the drawer is dismissed by interacting outside of the drawer.
|
|
25
|
+
*/
|
|
26
|
+
onDismiss?: () => void;
|
|
27
|
+
/**
|
|
28
|
+
* Testing id of the component.
|
|
29
|
+
* */
|
|
30
|
+
testID?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const Drawer = ({
|
|
34
|
+
visible,
|
|
35
|
+
children,
|
|
36
|
+
hasBackdrop = true,
|
|
37
|
+
onDismiss,
|
|
38
|
+
testID,
|
|
39
|
+
}: DrawerProps): JSX.Element => {
|
|
40
|
+
const animatedValue = useRef(new Animated.Value(visible ? 1 : 0)).current;
|
|
41
|
+
const [height, setHeight] = useState(0);
|
|
42
|
+
|
|
43
|
+
const enableShadow = visible && !hasBackdrop;
|
|
44
|
+
|
|
45
|
+
const interpolateTranslateY = animatedValue.interpolate({
|
|
46
|
+
inputRange: [0, 1],
|
|
47
|
+
outputRange: [-height, 0],
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const interpolateBackdropOpacity = hasBackdrop
|
|
51
|
+
? animatedValue.interpolate({
|
|
52
|
+
inputRange: [0, 1],
|
|
53
|
+
outputRange: [0, 0.35],
|
|
54
|
+
})
|
|
55
|
+
: 0;
|
|
56
|
+
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
const animation = Animated.timing(animatedValue, {
|
|
59
|
+
toValue: visible ? 1 : 0,
|
|
60
|
+
easing: Easing.inOut(Easing.cubic),
|
|
61
|
+
useNativeDriver: true,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
animation.start();
|
|
65
|
+
|
|
66
|
+
return () => animation.stop();
|
|
67
|
+
}, [visible]);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<StyledContainer
|
|
71
|
+
testID={testID}
|
|
72
|
+
enableShadow={enableShadow}
|
|
73
|
+
pointerEvents="box-none"
|
|
74
|
+
>
|
|
75
|
+
<StyledBackdrop
|
|
76
|
+
pointerEvents={visible ? 'auto' : 'box-none'}
|
|
77
|
+
onPress={onDismiss}
|
|
78
|
+
style={{ opacity: interpolateBackdropOpacity }}
|
|
79
|
+
/>
|
|
80
|
+
<StyledDrawerContainer
|
|
81
|
+
enableShadow={enableShadow}
|
|
82
|
+
onLayout={({ nativeEvent }) => setHeight(nativeEvent.layout.height)}
|
|
83
|
+
style={{
|
|
84
|
+
transform: [{ translateY: interpolateTranslateY }],
|
|
85
|
+
}}
|
|
86
|
+
>
|
|
87
|
+
{children}
|
|
88
|
+
</StyledDrawerContainer>
|
|
89
|
+
</StyledContainer>
|
|
90
|
+
);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export default Drawer;
|
|
@@ -464,12 +464,14 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
464
464
|
Array [
|
|
465
465
|
Object {
|
|
466
466
|
"alignItems": "center",
|
|
467
|
+
"alignSelf": "flex-start",
|
|
467
468
|
"backgroundColor": "#292a2b",
|
|
468
469
|
"borderRadius": 999,
|
|
469
|
-
"
|
|
470
|
+
"flexDirection": "row",
|
|
470
471
|
"justifyContent": "center",
|
|
471
472
|
"overflow": "hidden",
|
|
472
|
-
"
|
|
473
|
+
"paddingHorizontal": 16,
|
|
474
|
+
"paddingVertical": 16,
|
|
473
475
|
},
|
|
474
476
|
Array [
|
|
475
477
|
Object {
|
|
@@ -483,41 +485,47 @@ exports[`ActionGroup has active false 1`] = `
|
|
|
483
485
|
}
|
|
484
486
|
testID="fab"
|
|
485
487
|
>
|
|
486
|
-
<
|
|
487
|
-
|
|
488
|
-
nativeID="animatedComponent"
|
|
488
|
+
<HeroIcon
|
|
489
|
+
name="add"
|
|
489
490
|
style={
|
|
490
|
-
|
|
491
|
-
|
|
491
|
+
Array [
|
|
492
|
+
Object {
|
|
493
|
+
"color": "#292a2b",
|
|
494
|
+
"fontSize": 16,
|
|
495
|
+
},
|
|
496
|
+
Array [
|
|
492
497
|
Object {
|
|
493
|
-
"
|
|
498
|
+
"color": "#ffffff",
|
|
499
|
+
"lineHeight": 24,
|
|
500
|
+
"textAlign": "center",
|
|
501
|
+
"textAlignVertical": "center",
|
|
494
502
|
},
|
|
503
|
+
undefined,
|
|
495
504
|
],
|
|
496
|
-
|
|
505
|
+
]
|
|
506
|
+
}
|
|
507
|
+
testID="styled-fab-icon"
|
|
508
|
+
themeIntent="text"
|
|
509
|
+
themeSize="xsmall"
|
|
510
|
+
/>
|
|
511
|
+
<Text
|
|
512
|
+
style={
|
|
513
|
+
Array [
|
|
514
|
+
Object {
|
|
515
|
+
"color": "#ffffff",
|
|
516
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
517
|
+
"fontSize": 16,
|
|
518
|
+
"lineHeight": 24,
|
|
519
|
+
"marginHorizontal": 8,
|
|
520
|
+
"textAlign": "center",
|
|
521
|
+
"textAlignVertical": "center",
|
|
522
|
+
},
|
|
523
|
+
undefined,
|
|
524
|
+
]
|
|
497
525
|
}
|
|
498
526
|
>
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
style={
|
|
502
|
-
Array [
|
|
503
|
-
Object {
|
|
504
|
-
"color": "#292a2b",
|
|
505
|
-
"fontSize": 24,
|
|
506
|
-
},
|
|
507
|
-
Array [
|
|
508
|
-
Object {
|
|
509
|
-
"color": "#ffffff",
|
|
510
|
-
"fontSize": 24,
|
|
511
|
-
},
|
|
512
|
-
Object {},
|
|
513
|
-
],
|
|
514
|
-
]
|
|
515
|
-
}
|
|
516
|
-
testID="animated-fab-icon"
|
|
517
|
-
themeIntent="text"
|
|
518
|
-
themeSize="medium"
|
|
519
|
-
/>
|
|
520
|
-
</View>
|
|
527
|
+
Shout out
|
|
528
|
+
</Text>
|
|
521
529
|
</View>
|
|
522
530
|
</View>
|
|
523
531
|
`;
|
|
@@ -986,12 +994,14 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
986
994
|
Array [
|
|
987
995
|
Object {
|
|
988
996
|
"alignItems": "center",
|
|
997
|
+
"alignSelf": "flex-start",
|
|
989
998
|
"backgroundColor": "#292a2b",
|
|
990
999
|
"borderRadius": 999,
|
|
991
|
-
"
|
|
1000
|
+
"flexDirection": "row",
|
|
992
1001
|
"justifyContent": "center",
|
|
993
1002
|
"overflow": "hidden",
|
|
994
|
-
"
|
|
1003
|
+
"paddingHorizontal": 16,
|
|
1004
|
+
"paddingVertical": 16,
|
|
995
1005
|
},
|
|
996
1006
|
Array [
|
|
997
1007
|
Object {
|
|
@@ -1005,41 +1015,47 @@ exports[`ActionGroup has active true 1`] = `
|
|
|
1005
1015
|
}
|
|
1006
1016
|
testID="fab"
|
|
1007
1017
|
>
|
|
1008
|
-
<
|
|
1009
|
-
|
|
1010
|
-
nativeID="animatedComponent"
|
|
1018
|
+
<HeroIcon
|
|
1019
|
+
name="add"
|
|
1011
1020
|
style={
|
|
1012
|
-
|
|
1013
|
-
|
|
1021
|
+
Array [
|
|
1022
|
+
Object {
|
|
1023
|
+
"color": "#292a2b",
|
|
1024
|
+
"fontSize": 16,
|
|
1025
|
+
},
|
|
1026
|
+
Array [
|
|
1014
1027
|
Object {
|
|
1015
|
-
"
|
|
1028
|
+
"color": "#ffffff",
|
|
1029
|
+
"lineHeight": 24,
|
|
1030
|
+
"textAlign": "center",
|
|
1031
|
+
"textAlignVertical": "center",
|
|
1016
1032
|
},
|
|
1033
|
+
undefined,
|
|
1017
1034
|
],
|
|
1018
|
-
|
|
1035
|
+
]
|
|
1036
|
+
}
|
|
1037
|
+
testID="styled-fab-icon"
|
|
1038
|
+
themeIntent="text"
|
|
1039
|
+
themeSize="xsmall"
|
|
1040
|
+
/>
|
|
1041
|
+
<Text
|
|
1042
|
+
style={
|
|
1043
|
+
Array [
|
|
1044
|
+
Object {
|
|
1045
|
+
"color": "#ffffff",
|
|
1046
|
+
"fontFamily": "BeVietnamPro-SemiBold",
|
|
1047
|
+
"fontSize": 16,
|
|
1048
|
+
"lineHeight": 24,
|
|
1049
|
+
"marginHorizontal": 8,
|
|
1050
|
+
"textAlign": "center",
|
|
1051
|
+
"textAlignVertical": "center",
|
|
1052
|
+
},
|
|
1053
|
+
undefined,
|
|
1054
|
+
]
|
|
1019
1055
|
}
|
|
1020
1056
|
>
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
style={
|
|
1024
|
-
Array [
|
|
1025
|
-
Object {
|
|
1026
|
-
"color": "#292a2b",
|
|
1027
|
-
"fontSize": 24,
|
|
1028
|
-
},
|
|
1029
|
-
Array [
|
|
1030
|
-
Object {
|
|
1031
|
-
"color": "#ffffff",
|
|
1032
|
-
"fontSize": 24,
|
|
1033
|
-
},
|
|
1034
|
-
Object {},
|
|
1035
|
-
],
|
|
1036
|
-
]
|
|
1037
|
-
}
|
|
1038
|
-
testID="animated-fab-icon"
|
|
1039
|
-
themeIntent="text"
|
|
1040
|
-
themeSize="medium"
|
|
1041
|
-
/>
|
|
1042
|
-
</View>
|
|
1057
|
+
Shout out
|
|
1058
|
+
</Text>
|
|
1043
1059
|
</View>
|
|
1044
1060
|
</View>
|
|
1045
1061
|
`;
|
|
@@ -12,6 +12,7 @@ describe('ActionGroup', () => {
|
|
|
12
12
|
`('has active $active', ({ active }) => {
|
|
13
13
|
const { toJSON, getByTestId, getByText } = renderWithTheme(
|
|
14
14
|
<ActionGroup
|
|
15
|
+
fabTitle="Shout out"
|
|
15
16
|
active={active}
|
|
16
17
|
headerTitle="What would you like to create?"
|
|
17
18
|
items={[
|
|
@@ -39,6 +40,7 @@ describe('ActionGroup', () => {
|
|
|
39
40
|
expect(toJSON()).toMatchSnapshot();
|
|
40
41
|
|
|
41
42
|
expect(getByText('What would you like to create?')).toBeDefined();
|
|
43
|
+
expect(getByText('Shout out')).toBeDefined();
|
|
42
44
|
expect(getByTestId('speaker-action-item')).toBeDefined();
|
|
43
45
|
expect(getByTestId('target-action-item')).toBeDefined();
|
|
44
46
|
expect(getByTestId('plane-action-item')).toBeDefined();
|
|
@@ -25,30 +25,40 @@ const ActionItemsListComponent = ({
|
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
export interface ActionGroupProps {
|
|
28
|
-
|
|
28
|
+
/**
|
|
29
29
|
* Title of the action group header.
|
|
30
30
|
*/
|
|
31
31
|
headerTitle?: string;
|
|
32
|
+
|
|
32
33
|
/**
|
|
33
34
|
* This function is called on pressing the FAB button.
|
|
34
35
|
* */
|
|
35
36
|
onPress?: () => void;
|
|
37
|
+
|
|
36
38
|
/**
|
|
37
39
|
* Specify if the FAB button is in active state and the action group is shown.
|
|
38
40
|
* */
|
|
39
41
|
active?: boolean;
|
|
40
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Title of the floating action button
|
|
45
|
+
*/
|
|
46
|
+
fabTitle?: string;
|
|
47
|
+
|
|
41
48
|
/**
|
|
42
49
|
* Additional style.
|
|
43
50
|
*/
|
|
44
51
|
style?: StyleProp<ViewStyle>;
|
|
52
|
+
|
|
45
53
|
/**
|
|
46
54
|
* Action items of the action group.
|
|
47
55
|
* */
|
|
56
|
+
|
|
48
57
|
items?: Array<ActionItemProps>;
|
|
49
58
|
/**
|
|
50
59
|
* Testing id of the component.
|
|
51
60
|
*/
|
|
61
|
+
|
|
52
62
|
testID?: string;
|
|
53
63
|
}
|
|
54
64
|
const ActionGroup = ({
|
|
@@ -58,6 +68,7 @@ const ActionGroup = ({
|
|
|
58
68
|
style,
|
|
59
69
|
items,
|
|
60
70
|
testID,
|
|
71
|
+
fabTitle,
|
|
61
72
|
}: ActionGroupProps) => {
|
|
62
73
|
const tranlateXAnimation = useRef<Animated.Value>(
|
|
63
74
|
new Animated.Value(active ? 1 : 0)
|
|
@@ -108,6 +119,7 @@ const ActionGroup = ({
|
|
|
108
119
|
onPress={onPress}
|
|
109
120
|
animated
|
|
110
121
|
active={active}
|
|
122
|
+
title={fabTitle}
|
|
111
123
|
/>
|
|
112
124
|
</StyledContainer>
|
|
113
125
|
);
|