Skip to content
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

[BUG] - ViewStyle does not allow color #53

Open
peterkuiper opened this issue Dec 30, 2019 · 2 comments · May be fixed by #55
Open

[BUG] - ViewStyle does not allow color #53

peterkuiper opened this issue Dec 30, 2019 · 2 comments · May be fixed by #55

Comments

@peterkuiper
Copy link

peterkuiper commented Dec 30, 2019

Describe the bug

When passing iconStyle={{ color: 'white' }} I am getting a typescript error:

Type '{ color: string; }' has no properties in common with type 'ViewStyle'.

This is due to iconStyle?: ViewStyle in index.d.ts. A simple solution would be to use any instead of ViewStyle. See https://github.com/oblador/react-native-vector-icons/blob/d969f8c8ba1cb6852b723af6ee4fefc4ee85b083/lib/icon-button.js#L80

To Reproduce

        <NumericInput 
            value={this.state.value} 
            onChange={value => this.setState({value})} 
            onLimitReached={(isMax,msg) => console.log(isMax,msg)}
            totalWidth={240} 
            totalHeight={50} 
            iconSize={25}
            step={1.5}
            valueType='real'
            rounded 
            textColor='#B0228C' 
            iconStyle={{ color: 'white' }} 
            rightButtonBackgroundColor='#EA3788' 
            leftButtonBackgroundColor='#E56B70'/>

Expected behavior

I would not expect a TypeScript error when using iconStyle.

Enviorment (please complete the following information):

  • Version: 1.8.3
  • React Native version: 0.61.4
  • Device: n/a
  • Device OS: n/a
@peterkuiper
Copy link
Author

peterkuiper commented Feb 5, 2020

It should be TextStyle instead of ViewStyle:

iconStyle is only used on which uses TextStyle, see https://github.com/DefinitelyTyped/DefinitelyTyped/blob/5a1c6ca6270addfda40b781d3ba65e716b162197/types/react-native-vector-icons/Icon.d.ts#L58

@peterkuiper peterkuiper linked a pull request Feb 5, 2020 that will close this issue
@ehdwns980416
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants