@momo-kits/tab-view 0.89.5 → 0.89.6
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/package.json +1 -1
- package/tabBar/CardTabBar.tsx +3 -3
- package/tabItem/CardTabItem.tsx +14 -5
- package/tabItem/TabItem.tsx +5 -3
package/package.json
CHANGED
package/tabBar/CardTabBar.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import {TabBarProps} from '../types';
|
|
|
4
4
|
import styles from '../styles';
|
|
5
5
|
import {
|
|
6
6
|
ApplicationContext,
|
|
7
|
-
|
|
7
|
+
Icon,
|
|
8
8
|
Radius,
|
|
9
9
|
Shadow,
|
|
10
10
|
Spacing,
|
|
@@ -62,8 +62,8 @@ const CardTabBar: FC<TabBarProps> = ({
|
|
|
62
62
|
},
|
|
63
63
|
]}>
|
|
64
64
|
{!!tabs[selectedIndex]?.icon && (
|
|
65
|
-
<
|
|
66
|
-
source={
|
|
65
|
+
<Icon
|
|
66
|
+
source={tabs[selectedIndex]?.icon}
|
|
67
67
|
style={[styles.icon, {marginRight: Spacing.XS}]}
|
|
68
68
|
/>
|
|
69
69
|
)}
|
package/tabItem/CardTabItem.tsx
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import React, {FC} from 'react';
|
|
1
|
+
import React, {FC, useContext} from 'react';
|
|
2
2
|
import {TouchableOpacity} from 'react-native';
|
|
3
3
|
import {TabItemProps} from '../types';
|
|
4
4
|
import styles from '../styles';
|
|
5
|
-
import {
|
|
5
|
+
import {ApplicationContext, Icon, Spacing, Text} from '@momo-kits/foundation';
|
|
6
6
|
|
|
7
|
-
const CardTabItem: FC<TabItemProps> = ({
|
|
7
|
+
const CardTabItem: FC<TabItemProps> = ({
|
|
8
|
+
tab,
|
|
9
|
+
active,
|
|
10
|
+
onPressTabItem,
|
|
11
|
+
width,
|
|
12
|
+
}) => {
|
|
8
13
|
const {title, icon} = tab;
|
|
14
|
+
const {theme} = useContext(ApplicationContext);
|
|
15
|
+
const color = active ? theme.colors.primary : theme.colors.text.default;
|
|
16
|
+
const tintColor = icon?.includes('http') ? null : color;
|
|
9
17
|
|
|
10
18
|
return (
|
|
11
19
|
<TouchableOpacity
|
|
12
20
|
onPress={onPressTabItem}
|
|
13
21
|
style={[styles.cardTabItem, {width}]}>
|
|
14
22
|
{!!icon && (
|
|
15
|
-
<
|
|
16
|
-
|
|
23
|
+
<Icon
|
|
24
|
+
color={tintColor}
|
|
17
25
|
style={[styles.icon, {marginRight: Spacing.XS}]}
|
|
26
|
+
source={icon}
|
|
18
27
|
/>
|
|
19
28
|
)}
|
|
20
29
|
<Text
|
package/tabItem/TabItem.tsx
CHANGED
|
@@ -5,7 +5,7 @@ import {TabItemProps} from '../types';
|
|
|
5
5
|
import {
|
|
6
6
|
ApplicationContext,
|
|
7
7
|
BadgeDot,
|
|
8
|
-
|
|
8
|
+
Icon,
|
|
9
9
|
Spacing,
|
|
10
10
|
Text,
|
|
11
11
|
Typography,
|
|
@@ -25,6 +25,7 @@ const TabItem: FC<TabItemProps> = ({tab, active, onPressTabItem, width}) => {
|
|
|
25
25
|
? 'header_s_semibold'
|
|
26
26
|
: 'body_default_regular';
|
|
27
27
|
const color = active ? theme.colors.primary : theme.colors.text.default;
|
|
28
|
+
const tintColor = icon?.includes('http') ? null : color;
|
|
28
29
|
const dotStyle = dotSize === 'large' ? styles.dot : styles.dotSmall;
|
|
29
30
|
const iconStyle: ViewStyle =
|
|
30
31
|
direction === 'row'
|
|
@@ -38,9 +39,10 @@ const TabItem: FC<TabItemProps> = ({tab, active, onPressTabItem, width}) => {
|
|
|
38
39
|
{!!icon && (
|
|
39
40
|
<View>
|
|
40
41
|
{showDot && <BadgeDot style={dotStyle} size={dotSize} />}
|
|
41
|
-
<
|
|
42
|
+
<Icon
|
|
43
|
+
color={tintColor}
|
|
42
44
|
style={[styles.icon, iconStyle as ImageStyle]}
|
|
43
|
-
source={
|
|
45
|
+
source={icon}
|
|
44
46
|
/>
|
|
45
47
|
</View>
|
|
46
48
|
)}
|