@momo-kits/tab-view 0.89.4 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momo-kits/tab-view",
3
- "version": "0.89.4",
3
+ "version": "0.89.6",
4
4
  "private": false,
5
5
  "main": "index.tsx",
6
6
  "dependencies": {},
@@ -4,7 +4,7 @@ import {TabBarProps} from '../types';
4
4
  import styles from '../styles';
5
5
  import {
6
6
  ApplicationContext,
7
- Image,
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
- <Image
66
- source={{uri: tabs[selectedIndex]?.icon}}
65
+ <Icon
66
+ source={tabs[selectedIndex]?.icon}
67
67
  style={[styles.icon, {marginRight: Spacing.XS}]}
68
68
  />
69
69
  )}
@@ -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 {Image, Spacing, Text} from '@momo-kits/foundation';
5
+ import {ApplicationContext, Icon, Spacing, Text} from '@momo-kits/foundation';
6
6
 
7
- const CardTabItem: FC<TabItemProps> = ({tab, onPressTabItem, width}) => {
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
- <Image
16
- source={{uri: icon}}
23
+ <Icon
24
+ color={tintColor}
17
25
  style={[styles.icon, {marginRight: Spacing.XS}]}
26
+ source={icon}
18
27
  />
19
28
  )}
20
29
  <Text
@@ -5,7 +5,7 @@ import {TabItemProps} from '../types';
5
5
  import {
6
6
  ApplicationContext,
7
7
  BadgeDot,
8
- Image,
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
- <Image
42
+ <Icon
43
+ color={tintColor}
42
44
  style={[styles.icon, iconStyle as ImageStyle]}
43
- source={{uri: icon}}
45
+ source={icon}
44
46
  />
45
47
  </View>
46
48
  )}