react-native-numeric-input icon indicating copy to clipboard operation
react-native-numeric-input copied to clipboard

[BUG] - ViewStyle does not allow color

Open peterkuiper opened this issue 5 years ago • 2 comments

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 avatar Dec 30 '19 14:12 peterkuiper

It should be TextStyle instead of ViewStyle:

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

peterkuiper avatar Feb 05 '20 17:02 peterkuiper

+1

ehdwns980416 avatar Apr 12 '21 02:04 ehdwns980416