Skip to content

Commit 58a223b

Browse files
authored
fix: revert 'replace MaterialCommunityIcon in favor of internal Icon' (callstack#3745)
1 parent 1ef5f69 commit 58a223b

File tree

11 files changed

+43
-45
lines changed

11 files changed

+43
-45
lines changed

Diff for: src/components/Appbar/AppbarBackIcon.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from 'react';
22
import { Platform, I18nManager, View, Image, StyleSheet } from 'react-native';
33

4-
import Icon from '../Icon';
4+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
55

66
const AppbarBackIcon = ({ size, color }: { size: number; color: string }) => {
77
const iosIconSize = size - 3;
@@ -27,8 +27,8 @@ const AppbarBackIcon = ({ size, color }: { size: number; color: string }) => {
2727
/>
2828
</View>
2929
) : (
30-
<Icon
31-
source="arrow-left"
30+
<MaterialCommunityIcon
31+
name="arrow-left"
3232
color={color}
3333
size={size}
3434
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}

Diff for: src/components/Checkbox/CheckboxAndroid.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {
88

99
import { useInternalTheme } from '../../core/theming';
1010
import type { $RemoveChildren, ThemeProp } from '../../types';
11-
import Icon from '../Icon';
11+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
1212
import TouchableRipple from '../TouchableRipple/TouchableRipple';
1313
import { getAndroidSelectionControlColor } from './utils';
1414

@@ -143,9 +143,9 @@ const CheckboxAndroid = ({
143143
theme={theme}
144144
>
145145
<Animated.View style={{ transform: [{ scale: scaleAnim }] }}>
146-
<Icon
146+
<MaterialCommunityIcon
147147
allowFontScaling={false}
148-
source={icon}
148+
name={icon}
149149
size={24}
150150
color={selectionControlColor}
151151
direction="ltr"

Diff for: src/components/Checkbox/CheckboxIOS.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { GestureResponderEvent, StyleSheet, View } from 'react-native';
33

44
import { useInternalTheme } from '../../core/theming';
55
import type { $RemoveChildren, ThemeProp } from '../../types';
6-
import Icon from '../Icon';
6+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
77
import TouchableRipple from '../TouchableRipple/TouchableRipple';
88
import { getSelectionControlIOSColor } from './utils';
99

@@ -86,9 +86,9 @@ const CheckboxIOS = ({
8686
theme={theme}
8787
>
8888
<View style={{ opacity }}>
89-
<Icon
89+
<MaterialCommunityIcon
9090
allowFontScaling={false}
91-
source={icon}
91+
name={icon}
9292
size={24}
9393
color={checkedColor}
9494
direction="ltr"

Diff for: src/components/Chip/Chip.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { white } from '../../styles/themes/v2/colors';
1717
import type { EllipsizeProp, ThemeProp } from '../../types';
1818
import type { IconSource } from '../Icon';
1919
import Icon from '../Icon';
20+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
2021
import Surface from '../Surface';
2122
import TouchableRipple from '../TouchableRipple/TouchableRipple';
2223
import Text from '../Typography/Text';
@@ -322,8 +323,8 @@ const Chip = ({
322323
theme={theme}
323324
/>
324325
) : (
325-
<Icon
326-
source="check"
326+
<MaterialCommunityIcon
327+
name="check"
327328
color={avatar ? white : iconColor}
328329
size={18}
329330
direction="ltr"
@@ -364,8 +365,8 @@ const Chip = ({
364365
{closeIcon ? (
365366
<Icon source={closeIcon} color={iconColor} size={iconSize} />
366367
) : (
367-
<Icon
368-
source={isV3 ? 'close' : 'close-circle'}
368+
<MaterialCommunityIcon
369+
name={isV3 ? 'close' : 'close-circle'}
369370
size={iconSize}
370371
color={iconColor}
371372
direction="ltr"

Diff for: src/components/DataTable/DataTablePagination.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import type { ThemeProp } from 'src/types';
1212

1313
import { useInternalTheme } from '../../core/theming';
1414
import Button from '../Button/Button';
15-
import Icon from '../Icon';
1615
import IconButton from '../IconButton/IconButton';
16+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
1717
import Menu from '../Menu/Menu';
1818
import Text from '../Typography/Text';
1919

@@ -101,8 +101,8 @@ const PaginationControls = ({
101101
{showFastPaginationControls ? (
102102
<IconButton
103103
icon={({ size, color }) => (
104-
<Icon
105-
source="page-first"
104+
<MaterialCommunityIcon
105+
name="page-first"
106106
color={color}
107107
size={size}
108108
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}
@@ -117,8 +117,8 @@ const PaginationControls = ({
117117
) : null}
118118
<IconButton
119119
icon={({ size, color }) => (
120-
<Icon
121-
source="chevron-left"
120+
<MaterialCommunityIcon
121+
name="chevron-left"
122122
color={color}
123123
size={size}
124124
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}
@@ -132,8 +132,8 @@ const PaginationControls = ({
132132
/>
133133
<IconButton
134134
icon={({ size, color }) => (
135-
<Icon
136-
source="chevron-right"
135+
<MaterialCommunityIcon
136+
name="chevron-right"
137137
color={color}
138138
size={size}
139139
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}
@@ -148,8 +148,8 @@ const PaginationControls = ({
148148
{showFastPaginationControls ? (
149149
<IconButton
150150
icon={({ size, color }) => (
151-
<Icon
152-
source="page-last"
151+
<MaterialCommunityIcon
152+
name="page-last"
153153
color={color}
154154
size={size}
155155
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}

Diff for: src/components/DataTable/DataTableTitle.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import color from 'color';
1515

1616
import { useInternalTheme } from '../../core/theming';
1717
import type { ThemeProp } from '../../types';
18-
import Icon from '../Icon';
18+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
1919
import Text from '../Typography/Text';
2020

2121
export type Props = React.ComponentPropsWithRef<
@@ -120,8 +120,8 @@ const DataTableTitle = ({
120120

121121
const icon = sortDirection ? (
122122
<Animated.View style={[styles.icon, { transform: [{ rotate: spin }] }]}>
123-
<Icon
124-
source="arrow-up"
123+
<MaterialCommunityIcon
124+
name="arrow-up"
125125
size={16}
126126
color={textColor}
127127
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}

Diff for: src/components/Icon.tsx

+3-6
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ type IconProps = {
2424
};
2525

2626
type Props = IconProps & {
27-
source: any;
2827
color?: string;
29-
direction?: 'rtl' | 'ltr' | 'auto';
28+
source: any;
3029
/**
3130
* @optional
3231
*/
@@ -73,19 +72,17 @@ const Icon = ({
7372
color,
7473
size,
7574
theme: themeOverrides,
76-
direction: customDirection,
7775
...rest
7876
}: Props) => {
7977
const theme = useInternalTheme(themeOverrides);
8078
const direction =
81-
customDirection ||
82-
(typeof source === 'object' && source.direction && source.source
79+
typeof source === 'object' && source.direction && source.source
8380
? source.direction === 'auto'
8481
? I18nManager.getConstants().isRTL
8582
? 'rtl'
8683
: 'ltr'
8784
: source.direction
88-
: null);
85+
: null;
8986

9087
const s =
9188
typeof source === 'object' && source.direction && source.source

Diff for: src/components/List/ListAccordion.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212

1313
import { useInternalTheme } from '../../core/theming';
1414
import type { ThemeProp } from '../../types';
15-
import Icon from '../Icon';
15+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
1616
import TouchableRipple from '../TouchableRipple/TouchableRipple';
1717
import Text from '../Typography/Text';
1818
import { ListAccordionGroupContext } from './ListAccordionGroup';
@@ -262,8 +262,8 @@ const ListAccordion = ({
262262
isExpanded: isExpanded,
263263
})
264264
) : (
265-
<Icon
266-
source={isExpanded ? 'chevron-up' : 'chevron-down'}
265+
<MaterialCommunityIcon
266+
name={isExpanded ? 'chevron-up' : 'chevron-down'}
267267
color={theme.isV3 ? descriptionColor : titleColor}
268268
size={24}
269269
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}

Diff for: src/components/RadioButton/RadioButtonIOS.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { GestureResponderEvent, StyleSheet, View } from 'react-native';
44
import { useInternalTheme } from '../../core/theming';
55
import type { $RemoveChildren, InternalTheme } from '../../types';
66
import { getSelectionControlIOSColor } from '../Checkbox/utils';
7-
import Icon from '../Icon';
7+
import MaterialCommunityIcon from '../MaterialCommunityIcon';
88
import TouchableRipple from '../TouchableRipple/TouchableRipple';
99
import { RadioButtonContext, RadioButtonContextType } from './RadioButtonGroup';
1010
import { handlePress, isChecked } from './utils';
@@ -109,9 +109,9 @@ const RadioButtonIOS = ({
109109
theme={theme}
110110
>
111111
<View style={{ opacity }}>
112-
<Icon
112+
<MaterialCommunityIcon
113113
allowFontScaling={false}
114-
source="check"
114+
name="check"
115115
size={24}
116116
color={checkedColor}
117117
direction="ltr"

Diff for: src/components/Searchbar.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import { forwardRef } from '../utils/forwardRef';
2121
import ActivityIndicator from './ActivityIndicator';
2222
import Divider from './Divider';
2323
import type { IconSource } from './Icon';
24-
import Icon from './Icon';
2524
import IconButton from './IconButton/IconButton';
25+
import MaterialCommunityIcon from './MaterialCommunityIcon';
2626
import Surface from './Surface';
2727

2828
interface Style {
@@ -291,8 +291,8 @@ const Searchbar = forwardRef<TextInputHandles, Props>(
291291
icon={
292292
icon ||
293293
(({ size, color }) => (
294-
<Icon
295-
source="magnify"
294+
<MaterialCommunityIcon
295+
name="magnify"
296296
color={color}
297297
size={size}
298298
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}
@@ -352,8 +352,8 @@ const Searchbar = forwardRef<TextInputHandles, Props>(
352352
icon={
353353
clearIcon ||
354354
(({ size, color }) => (
355-
<Icon
356-
source={isV3 ? 'close' : 'close-circle-outline'}
355+
<MaterialCommunityIcon
356+
name={isV3 ? 'close' : 'close-circle-outline'}
357357
color={color}
358358
size={size}
359359
direction={I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'}

Diff for: src/components/Snackbar.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { useInternalTheme } from '../core/theming';
1616
import type { $RemoveChildren, ThemeProp } from '../types';
1717
import Button from './Button/Button';
1818
import type { IconSource } from './Icon';
19-
import Icon from './Icon';
2019
import IconButton from './IconButton/IconButton';
20+
import MaterialCommunityIcon from './MaterialCommunityIcon';
2121
import Surface from './Surface';
2222
import Text from './Typography/Text';
2323

@@ -321,8 +321,8 @@ const Snackbar = ({
321321
icon ||
322322
(({ size, color }) => {
323323
return (
324-
<Icon
325-
source="close"
324+
<MaterialCommunityIcon
325+
name="close"
326326
color={color}
327327
size={size}
328328
direction={

0 commit comments

Comments
 (0)