Skip to content

Commit f5338ca

Browse files
authored
Fix icons from being cut off/clipped (#749)
1 parent 133388f commit f5338ca

File tree

3 files changed

+20
-28
lines changed

3 files changed

+20
-28
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, { width: size, height: size }]}
95+
style={[styles.container, style]}
9696
>
9797
<Icon
9898
style={styles.icon}

packages/core/src/components/IconButton.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ const IconButton: React.FC<React.PropsWithChildren<Props>> = ({
5252
styles.container,
5353
{
5454
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
55-
width: size,
56-
height: size,
5755
alignItems: "center",
5856
justifyContent: "center",
5957
},
Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
import * as React from "react";
2-
import {
3-
View,
4-
StyleSheet,
5-
ViewProps,
6-
StyleProp,
7-
ImageStyle,
8-
Platform,
9-
} from "react-native";
2+
import { ViewProps, StyleProp, ImageStyle, Platform } from "react-native";
103

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

3730
return (
38-
<View style={[styles.container, { width: size, height: size }, style]}>
39-
<IconSet {...rest} name={name} color={color} size={size} />
40-
</View>
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+
/>
4149
);
4250
};
4351

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-
5852
export default Icon;

0 commit comments

Comments
 (0)