Skip to content

Commit

Permalink
Fix icons from being cut off/clipped (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoussefHenna authored Jul 27, 2023
1 parent 45be490 commit 7b37204
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 28 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/components/Checkbox/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const Checkbox: React.FC<CheckboxProps & PressableProps & IconSlot> = ({
accessibilityState={{ disabled }}
accessibilityRole="button"
accessibilityLiveRegion="polite"
style={[styles.container, style, { width: size, height: size }]}
style={[styles.container, style]}
>
<Icon
style={styles.icon}
Expand Down
2 changes: 0 additions & 2 deletions packages/core/src/components/IconButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@ const IconButton: React.FC<React.PropsWithChildren<Props>> = ({
styles.container,
{
opacity: pressed ? activeOpacity : disabled ? disabledOpacity : 1,
width: size,
height: size,
alignItems: "center",
justifyContent: "center",
},
Expand Down
44 changes: 19 additions & 25 deletions packages/native/src/components/Icon.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import * as React from "react";
import {
View,
StyleSheet,
ViewProps,
StyleProp,
ImageStyle,
Platform,
} from "react-native";
import { ViewProps, StyleProp, ImageStyle, Platform } from "react-native";

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

return (
<View style={[styles.container, { width: size, height: size }, style]}>
<IconSet {...rest} name={name} color={color} size={size} />
</View>
<IconSet
{...rest}
name={name}
color={color}
size={size}
style={[
{
...Platform.select({
web: {
cursor: "pointer",
userSelect: "none",
},
}),
},
,
style,
]}
/>
);
};

const styles = StyleSheet.create({
container: {
alignItems: "center",
justifyContent: "center",
overflow: "hidden",
...Platform.select({
web: {
cursor: "pointer",
userSelect: "none",
},
}),
},
});

export default Icon;

0 comments on commit 7b37204

Please sign in to comment.