File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export type IconProps = Omit<RNImageProps, 'source' | 'tintColor'> &
31
31
/**
32
32
* the icon size
33
33
*/
34
- size ?: number ;
34
+ size ?: number | { width : number ; height : number } ;
35
35
/**
36
36
* whether the icon should flip horizontally on RTL
37
37
*/
@@ -62,7 +62,6 @@ const Icon = forwardRef((props: Props, ref: any) => {
62
62
...others
63
63
} = props ;
64
64
const { margins} = modifiers ;
65
- const iconSize = size ? { width : size , height : size } : undefined ;
66
65
const shouldFlipRTL = supportRTL && Constants . isRTL ;
67
66
68
67
const getBadgeStyling = ( ) : StyleProp < ViewStyle > => {
@@ -77,6 +76,16 @@ const Icon = forwardRef((props: Props, ref: any) => {
77
76
return [ badgePosition , containerStyle ] ;
78
77
} ;
79
78
79
+ const iconSize = useMemo ( ( ) => {
80
+ if ( typeof size === 'number' ) {
81
+ return { width : size , height : size } ;
82
+ }
83
+ if ( typeof size === 'object' ) {
84
+ return size ;
85
+ }
86
+ return undefined ;
87
+ } , [ size ] ) ;
88
+
80
89
const iconSource = useMemo ( ( ) => {
81
90
if ( ! isUndefined ( assetName ) ) {
82
91
return getAsset ( assetName , assetGroup ) ;
You can’t perform that action at this time.
0 commit comments