@hero-design/rn 7.1.3-alpha7 → 7.1.3-alpha8
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/packager-info.json +1 -1
- package/es/index.js +132 -79
- package/lib/index.js +132 -79
- package/package.json +1 -1
- package/playground/components/BottomNavigation.tsx +1 -1
- package/playground/components/Tabs.tsx +1 -1
- package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/BottomNavigation/__tests__/index.spec.tsx +2 -2
- package/src/components/BottomNavigation/index.tsx +6 -10
- package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +0 -1
- package/src/components/Tabs/__tests__/index.spec.tsx +2 -2
- package/src/components/Tabs/index.tsx +19 -15
- package/src/theme/global/borders.ts +8 -2
- package/src/theme/global/colors.ts +3 -1
- package/src/theme/global/index.ts +31 -17
- package/src/theme/global/scale.ts +18 -0
- package/src/theme/global/space.ts +23 -13
- package/src/theme/global/typography.ts +71 -27
- package/src/theme/index.ts +27 -14
- package/types/src/components/BottomNavigation/index.d.ts +3 -3
- package/types/src/components/Tabs/index.d.ts +3 -3
- package/types/src/theme/global/borders.d.ts +4 -3
- package/types/src/theme/global/colors.d.ts +2 -2
- package/types/src/theme/global/index.d.ts +10 -45
- package/types/src/theme/global/scale.d.ts +8 -0
- package/types/src/theme/global/space.d.ts +8 -7
- package/types/src/theme/global/typography.d.ts +9 -16
- package/types/src/theme/index.d.ts +2 -2
- package/yarn-error.log +0 -140
|
@@ -8,7 +8,7 @@ import BottomNavigation, { BottomNavigationTabType } from '..';
|
|
|
8
8
|
const TestComponent = (
|
|
9
9
|
props: Omit<
|
|
10
10
|
ComponentProps<typeof BottomNavigation>,
|
|
11
|
-
'selectedTabKey' | '
|
|
11
|
+
'selectedTabKey' | 'onTabPress' | 'tabs'
|
|
12
12
|
>
|
|
13
13
|
) => {
|
|
14
14
|
const [selectedTabKey, setSelectedTabKey] = React.useState('home');
|
|
@@ -50,7 +50,7 @@ const TestComponent = (
|
|
|
50
50
|
{...props}
|
|
51
51
|
tabs={tabs}
|
|
52
52
|
selectedTabKey={selectedTabKey}
|
|
53
|
-
|
|
53
|
+
onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
|
|
54
54
|
/>
|
|
55
55
|
</SafeAreaProvider>
|
|
56
56
|
);
|
|
@@ -29,9 +29,9 @@ export type BottomNavigationTabType = {
|
|
|
29
29
|
|
|
30
30
|
interface BottomNavigationProps extends ViewProps {
|
|
31
31
|
/**
|
|
32
|
-
* Callback which is called on tab
|
|
32
|
+
* Callback which is called on tab press, receiving key of upcoming active Tab.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
onTabPress: (key: string) => void;
|
|
35
35
|
/**
|
|
36
36
|
* Whether inactive tabs should be removed and unmounted in React.
|
|
37
37
|
* Defaults to `false`.
|
|
@@ -67,7 +67,7 @@ const getInactiveIcon = (icon: IconName): IconName => {
|
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
const BottomNavigation = ({
|
|
70
|
-
|
|
70
|
+
onTabPress,
|
|
71
71
|
renderActiveTabOnly = false,
|
|
72
72
|
selectedTabKey,
|
|
73
73
|
tabs,
|
|
@@ -89,7 +89,7 @@ const BottomNavigation = ({
|
|
|
89
89
|
<BottomNavigationContainer {...nativeProps}>
|
|
90
90
|
<ContentWrapper>
|
|
91
91
|
{tabs.map(tab => {
|
|
92
|
-
const { key, component } = tab;
|
|
92
|
+
const { key, component, testID } = tab;
|
|
93
93
|
const active = selectedTabKey === key;
|
|
94
94
|
|
|
95
95
|
if (renderActiveTabOnly && !active) {
|
|
@@ -104,7 +104,7 @@ const BottomNavigation = ({
|
|
|
104
104
|
return (
|
|
105
105
|
<BottomNavigationTab
|
|
106
106
|
key={key}
|
|
107
|
-
testID={`route-screen-${
|
|
107
|
+
testID={testID ? `route-screen-${testID}` : undefined}
|
|
108
108
|
pointerEvents={active ? 'auto' : 'none'}
|
|
109
109
|
accessibilityElementsHidden={!active}
|
|
110
110
|
importantForAccessibility={
|
|
@@ -133,11 +133,7 @@ const BottomNavigation = ({
|
|
|
133
133
|
return (
|
|
134
134
|
<TouchableWithoutFeedback
|
|
135
135
|
key={key}
|
|
136
|
-
onPress={() =>
|
|
137
|
-
if (key !== selectedTabKey) {
|
|
138
|
-
onChange(key);
|
|
139
|
-
}
|
|
140
|
-
}}
|
|
136
|
+
onPress={() => onTabPress(key)}
|
|
141
137
|
testID={testID}
|
|
142
138
|
>
|
|
143
139
|
<BottomBarItem>
|
|
@@ -8,7 +8,7 @@ import Tabs, { TabType } from '..';
|
|
|
8
8
|
const TestTabsComponent = (
|
|
9
9
|
props: Omit<
|
|
10
10
|
ComponentProps<typeof Tabs>,
|
|
11
|
-
'selectedTabKey' | '
|
|
11
|
+
'selectedTabKey' | 'onTabPress' | 'tabs'
|
|
12
12
|
>
|
|
13
13
|
) => {
|
|
14
14
|
const [selectedTabKey, setSelectedTabKey] = React.useState('work');
|
|
@@ -38,7 +38,7 @@ const TestTabsComponent = (
|
|
|
38
38
|
{...props}
|
|
39
39
|
tabs={tabs}
|
|
40
40
|
selectedTabKey={selectedTabKey}
|
|
41
|
-
|
|
41
|
+
onTabPress={newTabKey => setSelectedTabKey(newTabKey)}
|
|
42
42
|
/>
|
|
43
43
|
</SafeAreaProvider>
|
|
44
44
|
);
|
|
@@ -30,9 +30,9 @@ export type TabType = {
|
|
|
30
30
|
|
|
31
31
|
interface TabsProps extends ViewProps {
|
|
32
32
|
/**
|
|
33
|
-
* Callback which is called on tab
|
|
33
|
+
* Callback which is called on tab press, receiving key of upcoming active Tab.
|
|
34
34
|
*/
|
|
35
|
-
|
|
35
|
+
onTabPress: (key: string) => void;
|
|
36
36
|
/**
|
|
37
37
|
* Whether inactive tabs should be removed and unmounted in React.
|
|
38
38
|
* Defaults to `false`.
|
|
@@ -63,7 +63,7 @@ interface TabsProps extends ViewProps {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const Tabs = ({
|
|
66
|
-
|
|
66
|
+
onTabPress,
|
|
67
67
|
renderActiveTabOnly = false,
|
|
68
68
|
selectedTabKey,
|
|
69
69
|
tabs,
|
|
@@ -77,6 +77,18 @@ const Tabs = ({
|
|
|
77
77
|
*/
|
|
78
78
|
const [loaded, setLoaded] = React.useState([selectedTabKey]);
|
|
79
79
|
|
|
80
|
+
React.useEffect(() => {
|
|
81
|
+
const selectedTabIndex = tabs.findIndex(
|
|
82
|
+
item => item.key === selectedTabKey
|
|
83
|
+
);
|
|
84
|
+
if (selectedTabIndex !== -1) {
|
|
85
|
+
flatListRef.current?.scrollToIndex({
|
|
86
|
+
index: selectedTabIndex,
|
|
87
|
+
viewPosition: 0.5,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}, [selectedTabKey, tabs]);
|
|
91
|
+
|
|
80
92
|
if (!loaded.includes(selectedTabKey)) {
|
|
81
93
|
// Set the current tab to be loaded if it was not loaded before
|
|
82
94
|
setLoaded(loadedState => [...loadedState, selectedTabKey]);
|
|
@@ -101,22 +113,14 @@ const Tabs = ({
|
|
|
101
113
|
100
|
|
102
114
|
);
|
|
103
115
|
}}
|
|
104
|
-
renderItem={({ item: tab
|
|
116
|
+
renderItem={({ item: tab }) => {
|
|
105
117
|
const { key, icon, title, testID } = tab;
|
|
106
118
|
const active = selectedTabKey === key;
|
|
107
119
|
|
|
108
120
|
return (
|
|
109
121
|
<TouchableOpacity
|
|
110
122
|
key={key}
|
|
111
|
-
onPress={() =>
|
|
112
|
-
if (key !== selectedTabKey) {
|
|
113
|
-
onChange(key);
|
|
114
|
-
flatListRef.current?.scrollToIndex({
|
|
115
|
-
index,
|
|
116
|
-
viewPosition: 0.5,
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}}
|
|
123
|
+
onPress={() => onTabPress(key)}
|
|
120
124
|
testID={testID}
|
|
121
125
|
>
|
|
122
126
|
<HeaderTabItem>
|
|
@@ -140,7 +144,7 @@ const Tabs = ({
|
|
|
140
144
|
</HeaderTabWrapper>
|
|
141
145
|
<ContentWrapper>
|
|
142
146
|
{tabs.map(tab => {
|
|
143
|
-
const { key, component } = tab;
|
|
147
|
+
const { key, component, testID } = tab;
|
|
144
148
|
const active = selectedTabKey === key;
|
|
145
149
|
|
|
146
150
|
if (renderActiveTabOnly && !active) {
|
|
@@ -155,7 +159,7 @@ const Tabs = ({
|
|
|
155
159
|
return (
|
|
156
160
|
<TabScreen
|
|
157
161
|
key={key}
|
|
158
|
-
testID={`tab-screen-${
|
|
162
|
+
testID={testID ? `tab-screen-${testID}` : undefined}
|
|
159
163
|
pointerEvents={active ? 'auto' : 'none'}
|
|
160
164
|
accessibilityElementsHidden={!active}
|
|
161
165
|
importantForAccessibility={
|
|
@@ -1,21 +1,35 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { scale as defaultScale, Scale } from './scale';
|
|
2
|
+
import { systemPalette as defaultSystemPalette, SystemPalette } from './colors';
|
|
3
|
+
import { getFonts, getFontSizes, getLineHeights } from './typography';
|
|
4
|
+
import { getSpace } from './space';
|
|
5
|
+
import { getBorderWidths } from './borders';
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
fontSizes,
|
|
13
|
-
lineHeights,
|
|
14
|
-
borderWidths,
|
|
15
|
-
};
|
|
7
|
+
const getGlobalTheme = (scale: Scale, systemPalette: SystemPalette) => {
|
|
8
|
+
const fonts = getFonts(scale.font);
|
|
9
|
+
const fontSizes = getFontSizes(scale.fontSize);
|
|
10
|
+
const lineHeights = getLineHeights(fontSizes);
|
|
11
|
+
const borderWidths = getBorderWidths(scale.borderWidth);
|
|
12
|
+
const space = getSpace(scale.space);
|
|
16
13
|
|
|
17
|
-
|
|
14
|
+
return {
|
|
15
|
+
colors: {
|
|
16
|
+
...systemPalette,
|
|
17
|
+
},
|
|
18
|
+
fonts,
|
|
19
|
+
fontSizes,
|
|
20
|
+
lineHeights,
|
|
21
|
+
borderWidths,
|
|
22
|
+
space,
|
|
23
|
+
};
|
|
24
|
+
};
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
type GlobalTheme = ReturnType<typeof getGlobalTheme>;
|
|
20
27
|
|
|
21
|
-
export
|
|
28
|
+
export {
|
|
29
|
+
GlobalTheme,
|
|
30
|
+
Scale,
|
|
31
|
+
SystemPalette,
|
|
32
|
+
getGlobalTheme,
|
|
33
|
+
defaultScale,
|
|
34
|
+
defaultSystemPalette,
|
|
35
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const BASE_BORDER_WIDTH = 1;
|
|
2
|
+
|
|
3
|
+
const BASE_SPACE = 8;
|
|
4
|
+
|
|
5
|
+
const BASE_FONT = 'BeVietnamPro';
|
|
6
|
+
|
|
7
|
+
const BASE_FONT_SIZE = 10;
|
|
8
|
+
|
|
9
|
+
const scale = {
|
|
10
|
+
borderWidth: BASE_BORDER_WIDTH,
|
|
11
|
+
space: BASE_SPACE,
|
|
12
|
+
font: BASE_FONT,
|
|
13
|
+
fontSize: BASE_FONT_SIZE,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
type Scale = typeof scale;
|
|
17
|
+
|
|
18
|
+
export { scale, Scale };
|
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import { scale } from '../../utils/scale';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface Space {
|
|
4
|
+
large: number;
|
|
5
|
+
medium: number;
|
|
6
|
+
small: number;
|
|
7
|
+
xlarge: number;
|
|
8
|
+
xsmall: number;
|
|
9
|
+
xxlarge: number;
|
|
10
|
+
xxsmall: number;
|
|
11
|
+
xxxlarge: number;
|
|
12
|
+
xxxxlarge: number;
|
|
13
|
+
}
|
|
4
14
|
|
|
5
|
-
const
|
|
6
|
-
xxsmall: scale(
|
|
7
|
-
xsmall: scale(
|
|
8
|
-
small: scale(
|
|
9
|
-
medium: scale(
|
|
10
|
-
large: scale(
|
|
11
|
-
xlarge: scale(
|
|
12
|
-
xxlarge: scale(
|
|
13
|
-
xxxlarge: scale(
|
|
14
|
-
xxxxlarge: scale(
|
|
15
|
-
};
|
|
15
|
+
const getSpace = (baseSpace: number): Space => ({
|
|
16
|
+
xxsmall: scale(baseSpace * 0.25),
|
|
17
|
+
xsmall: scale(baseSpace * 0.5),
|
|
18
|
+
small: scale(baseSpace),
|
|
19
|
+
medium: scale(baseSpace * 2),
|
|
20
|
+
large: scale(baseSpace * 3),
|
|
21
|
+
xlarge: scale(baseSpace * 4),
|
|
22
|
+
xxlarge: scale(baseSpace * 5),
|
|
23
|
+
xxxlarge: scale(baseSpace * 6),
|
|
24
|
+
xxxxlarge: scale(baseSpace * 7),
|
|
25
|
+
});
|
|
16
26
|
|
|
17
|
-
export {
|
|
27
|
+
export { Space, getSpace };
|
|
@@ -1,35 +1,79 @@
|
|
|
1
1
|
import { scale } from '../../utils/scale';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface Fonts {
|
|
4
|
+
light: string;
|
|
5
|
+
regular: string;
|
|
6
|
+
semiBold: string;
|
|
7
|
+
}
|
|
4
8
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
interface FontSizes {
|
|
10
|
+
xxxxxlarge: number;
|
|
11
|
+
xxxxlarge: number;
|
|
12
|
+
xxxlarge: number;
|
|
13
|
+
xxlarge: number;
|
|
14
|
+
xlarge: number;
|
|
15
|
+
large: number;
|
|
16
|
+
medium: number;
|
|
17
|
+
small: number;
|
|
18
|
+
xsmall: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type LineHeights = FontSizes;
|
|
22
|
+
|
|
23
|
+
// Hero design web typo scale is following
|
|
24
|
+
// https://www.ibm.com/design/language/typography/type-specs-ui#scales
|
|
25
|
+
const genFontSize = (prev: number, at: number): number =>
|
|
26
|
+
prev + Math.floor(Math.abs((at - 2) / 4) + 1) * 2;
|
|
10
27
|
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
const getFonts = (baseFont: string): Fonts => ({
|
|
29
|
+
light: `${baseFont}-Light`,
|
|
30
|
+
regular: `${baseFont}-Regular`,
|
|
31
|
+
semiBold: `${baseFont}-SemiBold`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const getFontSizes = (baseFontSize: number): FontSizes => {
|
|
35
|
+
const fontSizes = Array.from(new Array(9));
|
|
36
|
+
fontSizes.forEach((_, index) => {
|
|
37
|
+
if (index === 0) {
|
|
38
|
+
fontSizes[0] = baseFontSize;
|
|
39
|
+
} else {
|
|
40
|
+
fontSizes[index] = genFontSize(fontSizes[index - 1], index);
|
|
41
|
+
}
|
|
42
|
+
return undefined;
|
|
43
|
+
});
|
|
44
|
+
return {
|
|
45
|
+
xxxxxlarge: scale(fontSizes[8]), // 32
|
|
46
|
+
xxxxlarge: scale(fontSizes[7]), // 28
|
|
47
|
+
xxxlarge: scale(fontSizes[6]), // 24
|
|
48
|
+
xxlarge: scale(fontSizes[5]), // 20
|
|
49
|
+
xlarge: scale(fontSizes[4]), // 18
|
|
50
|
+
large: scale(fontSizes[3]), // 16
|
|
51
|
+
medium: scale(fontSizes[2]), // 14
|
|
52
|
+
small: scale(fontSizes[1]), // 12
|
|
53
|
+
xsmall: scale(fontSizes[0]), // 10
|
|
54
|
+
};
|
|
21
55
|
};
|
|
22
56
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
57
|
+
const getLineHeights = (fontSizes: FontSizes): LineHeights => {
|
|
58
|
+
const additionalSpace = 8;
|
|
59
|
+
return {
|
|
60
|
+
xxxxxlarge: fontSizes.xxxxxlarge + additionalSpace,
|
|
61
|
+
xxxxlarge: fontSizes.xxxxlarge + additionalSpace,
|
|
62
|
+
xxxlarge: fontSizes.xxxlarge + additionalSpace,
|
|
63
|
+
xxlarge: fontSizes.xxlarge + additionalSpace,
|
|
64
|
+
xlarge: fontSizes.xlarge + additionalSpace,
|
|
65
|
+
large: fontSizes.large + additionalSpace,
|
|
66
|
+
medium: fontSizes.medium + additionalSpace,
|
|
67
|
+
small: fontSizes.small + additionalSpace,
|
|
68
|
+
xsmall: fontSizes.xsmall + additionalSpace,
|
|
69
|
+
};
|
|
33
70
|
};
|
|
34
71
|
|
|
35
|
-
export {
|
|
72
|
+
export {
|
|
73
|
+
Fonts,
|
|
74
|
+
FontSizes,
|
|
75
|
+
LineHeights,
|
|
76
|
+
getFonts,
|
|
77
|
+
getFontSizes,
|
|
78
|
+
getLineHeights,
|
|
79
|
+
};
|
package/src/theme/index.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
GlobalTheme,
|
|
3
|
+
Scale,
|
|
4
|
+
SystemPalette,
|
|
5
|
+
getGlobalTheme,
|
|
6
|
+
defaultScale,
|
|
7
|
+
defaultSystemPalette,
|
|
8
|
+
} from './global';
|
|
2
9
|
|
|
3
10
|
import getBadgeTheme from './components/badge';
|
|
4
11
|
import getBottomNavigationTheme from './components/bottomNavigation';
|
|
@@ -22,19 +29,25 @@ type Theme = GlobalTheme & {
|
|
|
22
29
|
};
|
|
23
30
|
};
|
|
24
31
|
|
|
25
|
-
const getTheme = (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
const getTheme = (
|
|
33
|
+
scale: Scale = defaultScale,
|
|
34
|
+
systemPallete: SystemPalette = defaultSystemPalette
|
|
35
|
+
): Theme => {
|
|
36
|
+
const globalTheme = getGlobalTheme(scale, systemPallete);
|
|
37
|
+
return {
|
|
38
|
+
...globalTheme,
|
|
39
|
+
__hd__: {
|
|
40
|
+
badge: getBadgeTheme(globalTheme),
|
|
41
|
+
bottomNavigation: getBottomNavigationTheme(globalTheme),
|
|
42
|
+
card: getCardTheme(globalTheme),
|
|
43
|
+
divider: getDividerTheme(globalTheme),
|
|
44
|
+
icon: getIconTheme(globalTheme),
|
|
45
|
+
tabs: getTabsTheme(globalTheme),
|
|
46
|
+
typography: getTypographyTheme(globalTheme),
|
|
47
|
+
fab: getFABTheme(globalTheme),
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
};
|
|
38
51
|
|
|
39
52
|
const theme = getTheme();
|
|
40
53
|
|
|
@@ -10,9 +10,9 @@ export declare type BottomNavigationTabType = {
|
|
|
10
10
|
};
|
|
11
11
|
interface BottomNavigationProps extends ViewProps {
|
|
12
12
|
/**
|
|
13
|
-
* Callback which is called on tab
|
|
13
|
+
* Callback which is called on tab press, receiving key of upcoming active Tab.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
onTabPress: (key: string) => void;
|
|
16
16
|
/**
|
|
17
17
|
* Whether inactive tabs should be removed and unmounted in React.
|
|
18
18
|
* Defaults to `false`.
|
|
@@ -41,5 +41,5 @@ interface BottomNavigationProps extends ViewProps {
|
|
|
41
41
|
*/
|
|
42
42
|
testID?: string;
|
|
43
43
|
}
|
|
44
|
-
declare const BottomNavigation: ({
|
|
44
|
+
declare const BottomNavigation: ({ onTabPress, renderActiveTabOnly, selectedTabKey, tabs, ...nativeProps }: BottomNavigationProps) => JSX.Element;
|
|
45
45
|
export default BottomNavigation;
|
|
@@ -10,9 +10,9 @@ export declare type TabType = {
|
|
|
10
10
|
};
|
|
11
11
|
interface TabsProps extends ViewProps {
|
|
12
12
|
/**
|
|
13
|
-
* Callback which is called on tab
|
|
13
|
+
* Callback which is called on tab press, receiving key of upcoming active Tab.
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
onTabPress: (key: string) => void;
|
|
16
16
|
/**
|
|
17
17
|
* Whether inactive tabs should be removed and unmounted in React.
|
|
18
18
|
* Defaults to `false`.
|
|
@@ -41,5 +41,5 @@ interface TabsProps extends ViewProps {
|
|
|
41
41
|
*/
|
|
42
42
|
testID?: string;
|
|
43
43
|
}
|
|
44
|
-
declare const Tabs: ({
|
|
44
|
+
declare const Tabs: ({ onTabPress, renderActiveTabOnly, selectedTabKey, tabs, ...nativeProps }: TabsProps) => JSX.Element;
|
|
45
45
|
export default Tabs;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { palette } from '@hero-design/colors';
|
|
2
1
|
declare const systemPalette: {
|
|
3
2
|
primary: string;
|
|
4
3
|
primaryLight: string;
|
|
@@ -23,4 +22,5 @@ declare const systemPalette: {
|
|
|
23
22
|
invertedText: string;
|
|
24
23
|
outline: string;
|
|
25
24
|
};
|
|
26
|
-
|
|
25
|
+
declare type SystemPalette = typeof systemPalette;
|
|
26
|
+
export { systemPalette, SystemPalette };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { scale as defaultScale, Scale } from './scale';
|
|
2
|
+
import { systemPalette as defaultSystemPalette, SystemPalette } from './colors';
|
|
3
|
+
declare const getGlobalTheme: (scale: Scale, systemPalette: SystemPalette) => {
|
|
2
4
|
colors: {
|
|
3
5
|
primary: string;
|
|
4
6
|
primaryLight: string;
|
|
@@ -23,48 +25,11 @@ declare const globalTheme: {
|
|
|
23
25
|
invertedText: string;
|
|
24
26
|
outline: string;
|
|
25
27
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
large: number;
|
|
32
|
-
xlarge: number;
|
|
33
|
-
xxlarge: number;
|
|
34
|
-
xxxlarge: number;
|
|
35
|
-
xxxxlarge: number;
|
|
36
|
-
};
|
|
37
|
-
fonts: {
|
|
38
|
-
light: string;
|
|
39
|
-
regular: string;
|
|
40
|
-
semiBold: string;
|
|
41
|
-
};
|
|
42
|
-
fontSizes: {
|
|
43
|
-
xxxxxlarge: number;
|
|
44
|
-
xxxxlarge: number;
|
|
45
|
-
xxxlarge: number;
|
|
46
|
-
xxlarge: number;
|
|
47
|
-
xlarge: number;
|
|
48
|
-
large: number;
|
|
49
|
-
medium: number;
|
|
50
|
-
small: number;
|
|
51
|
-
xsmall: number;
|
|
52
|
-
};
|
|
53
|
-
lineHeights: {
|
|
54
|
-
xxxxxlarge: number;
|
|
55
|
-
xxxxlarge: number;
|
|
56
|
-
xxxlarge: number;
|
|
57
|
-
xxlarge: number;
|
|
58
|
-
xlarge: number;
|
|
59
|
-
large: number;
|
|
60
|
-
medium: number;
|
|
61
|
-
small: number;
|
|
62
|
-
xsmall: number;
|
|
63
|
-
};
|
|
64
|
-
borderWidths: {
|
|
65
|
-
base: number;
|
|
66
|
-
};
|
|
28
|
+
fonts: import("./typography").Fonts;
|
|
29
|
+
fontSizes: import("./typography").FontSizes;
|
|
30
|
+
lineHeights: import("./typography").FontSizes;
|
|
31
|
+
borderWidths: import("./borders").BorderWidths;
|
|
32
|
+
space: import("./space").Space;
|
|
67
33
|
};
|
|
68
|
-
declare type GlobalTheme = typeof
|
|
69
|
-
export { GlobalTheme };
|
|
70
|
-
export default globalTheme;
|
|
34
|
+
declare type GlobalTheme = ReturnType<typeof getGlobalTheme>;
|
|
35
|
+
export { GlobalTheme, Scale, SystemPalette, getGlobalTheme, defaultScale, defaultSystemPalette, };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
xxsmall: number;
|
|
3
|
-
xsmall: number;
|
|
4
|
-
small: number;
|
|
5
|
-
medium: number;
|
|
1
|
+
interface Space {
|
|
6
2
|
large: number;
|
|
3
|
+
medium: number;
|
|
4
|
+
small: number;
|
|
7
5
|
xlarge: number;
|
|
6
|
+
xsmall: number;
|
|
8
7
|
xxlarge: number;
|
|
8
|
+
xxsmall: number;
|
|
9
9
|
xxxlarge: number;
|
|
10
10
|
xxxxlarge: number;
|
|
11
|
-
}
|
|
12
|
-
|
|
11
|
+
}
|
|
12
|
+
declare const getSpace: (baseSpace: number) => Space;
|
|
13
|
+
export { Space, getSpace };
|