Skip to content

Commit b87abb1

Browse files
murrple-1Murray Christopherson
and
Murray Christopherson
authored
fix: typing on IconComponent (#241)
* fix: typing on IconComponent * fixing some type issues with @expo --------- Co-authored-by: Murray Christopherson <murraychristopherson@gmail.com>
1 parent 7428e08 commit b87abb1

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

src/HeaderButton.tsx

+13-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@ import type { ComponentProps, ReactNode } from 'react';
1515
export type VisibleButtonProps = {
1616
title: string;
1717

18-
IconComponent?: React.ComponentType<{
19-
name: any; // TODO generify to support icon names
20-
style?: any;
21-
color?: ColorValue;
22-
size?: number;
23-
}>;
18+
IconComponent?:
19+
| React.ComponentType<{
20+
name: any; // TODO generify to support icon names
21+
style?: any;
22+
size?: number;
23+
color?: ColorValue;
24+
}>
25+
| React.ComponentType<{
26+
name: any; // TODO generify to support icon names
27+
style?: any;
28+
size?: number;
29+
color?: ColorValue | number;
30+
}>;
2431
iconName?: string;
2532
iconSize?: number;
2633
color?: ColorValue;

src/__tests__/HeaderButtons.test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('HeaderButtons', () => {
7171
const IoniconsHeaderButton = (props: HeaderButtonProps) => (
7272
<HeaderButton
7373
{...props}
74-
IconComponent={({ name }) => <Text>{name}</Text>}
74+
IconComponent={({ name }: { name: any }) => <Text>{name}</Text>}
7575
iconSize={23}
7676
color="blue"
7777
/>

0 commit comments

Comments
 (0)