Skip to content

Commit 0409388

Browse files
committed
Revert "Fix icons from being cut off/clipped (#749)"
This reverts commit f5338ca.
1 parent 98837af commit 0409388

File tree

3 files changed

+28
-20
lines changed

3 files changed

+28
-20
lines changed

packages/core/src/components/Checkbox/Checkbox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
9292
accessibilityState={{ disabled }}
9393
accessibilityRole="button"
9494
accessibilityLiveRegion="polite"
95-
style={[styles.container, style]}
95+
style={[styles.container, style, { width: size, height: size }]}
9696
>
9797
<Icon
9898
style={styles.icon}

packages/core/src/components/IconButton.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ const IconButton: React.FC<React.PropsWithChildren<Props>> = ({
5252
styles.container,
5353
{
5454
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
55+
width: size,
56+
height: size,
5557
alignItems: "center",
5658
justifyContent: "center",
5759
},

packages/native/src/components/Icon.tsx

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import * as React from "react";
2-
import { ViewProps, StyleProp, ImageStyle, Platform } from "react-native";
2+
import {
3+
View,
4+
StyleSheet,
5+
ViewProps,
6+
StyleProp,
7+
ImageStyle,
8+
Platform,
9+
} from "react-native";
310

411
// This must use require to work in both web as a published project and in Snack
512
const VectorIcons = require("@expo/vector-icons");
@@ -28,25 +35,24 @@ const Icon: React.FC<React.PropsWithChildren<Props>> = ({
2835
const IconSet = VectorIcons[iconSet];
2936

3037
return (
31-
<IconSet
32-
{...rest}
33-
name={name}
34-
color={color}
35-
size={size}
36-
style={[
37-
{
38-
...Platform.select({
39-
web: {
40-
cursor: "pointer",
41-
userSelect: "none",
42-
},
43-
}),
44-
},
45-
,
46-
style,
47-
]}
48-
/>
38+
<View style={[styles.container, { width: size, height: size }, style]}>
39+
<IconSet {...rest} name={name} color={color} size={size} />
40+
</View>
4941
);
5042
};
5143

44+
const styles = StyleSheet.create({
45+
container: {
46+
alignItems: "center",
47+
justifyContent: "center",
48+
overflow: "hidden",
49+
...Platform.select({
50+
web: {
51+
cursor: "pointer",
52+
userSelect: "none",
53+
},
54+
}),
55+
},
56+
});
57+
5258
export default Icon;

0 commit comments

Comments
 (0)