-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: typing on IconComponent #241
Conversation
Hello, and thank you for the PR! When you say it's a "probable" fix, how should I understand that? How did you test the change? Thank you 👍 🙂 |
Strictly speaking, I didn't test it within the confines of this project exclusively - the patch was written using Github tools, not a full However, in the project in which I encountered the issue, I was able to workaround the issue from the opposite direction - by casting to the more restrictive type: import React from 'react';
import { ColorValue } from 'react-native';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import {
HeaderButton,
HeaderButtonProps,
} from 'react-navigation-header-buttons';
export const IconHeaderButton: React.FunctionComponent<
HeaderButtonProps
> = props => (
<HeaderButton
IconComponent={
MaterialIcons as React.ComponentType<{
name: any;
style?: any;
color?: ColorValue;
size?: number;
}>
}
iconSize={23}
{...props}
/>
); and there were no issues encountered with using On the other hand, you, as the architect, may have legitimate concerns with extending the type definition, and what that means going forward for your exposed API. I have not deep-dived the project's code enough to know what those concerns may be, so this PR is a naive attempt at fixing a bug that affected "me", and hopefully others. Hence the use of "probable" - this PR fixes a bug, but I can't know the wider implications of this fix. |
hi @murrple-1 and thanks for your patience :)
that is just fine, my question was directed at whether you made sure in your project that the change has the intended effect? I'm happy to merge fixes, but, generally speaking, I merge fixes when there's some confirmation / indication that they work, I do not merge "probable" fixes. Thank you and hope this makes sense. 👍 |
Yes, in my project, the change has the intended and expected effect. |
I'll see what I can do about the lint failure... |
Issue was that the typing broke |
Thank you! :) |
This is a probable fix for #240
Expand the type of
IconComponent
to support the types employed byreact-native-vector-icons