react-select icon indicating copy to clipboard operation
react-select copied to clipboard

No such property as "styles"

Open roberthchapman opened this issue 8 years ago • 9 comments

Hi, when I try to restyle a Select using the latest version with your recommended technique on your styling page, I find that there is no such property as "styles" on Select so that <Select styles={customStyles}... generates an error. How are you supposed to do this when it says there is no such property as shown in your simple example?

Thanks, Rob

roberthchapman avatar Nov 01 '18 11:11 roberthchapman

For future reference, it is better to ask questions on StackOverflow, and use the "Issues" to post bugs and feature requests.

I have included a (very) simple example in this codesandbox.

cutterbl avatar Nov 01 '18 12:11 cutterbl

Thanks for the example but it didn't really address the issue I raised at all, which was that Select has no such property called "styles" and creates a Typescript error. It has "style" of course but no "styles". I have made sure to install the latest types file as well but how are you meant to get this working when there is no such property as "styles"?

Using the latest: [email protected] and @types/[email protected] select

roberthchapman avatar Nov 01 '18 12:11 roberthchapman

So someone needs to update the TS type descriptor files? I (personally) don't write a lot of TypeScript, but looking at the repository for these, there is absolutely an entry for styles on line 194.

cutterbl avatar Nov 01 '18 12:11 cutterbl

It may help to see your code...

cutterbl avatar Nov 01 '18 12:11 cutterbl

There's not really much to see beyond what I showed: import Select from 'react-select' <Select styles={customStyles}> is enough to generate the problem using the customStyles object from your /styles page on the react-select website, not because of the customStyles object of course but just because there is no such property as styles. I could show you the current code I am using but it doesn't address the fact styles doesn't exist...

<Select placeholder='Active' style={{height:40, flex:1, alignItems:'center', fontFamily:'"Roboto", "Helvetica", "Arial", sans-serif'}} options={this.activeValues()} disabled={isProcessing} labelKey='label' valueKey='value' onChange={((active: IActive) => this.onChangeActive(active))} clearable={false} value={this.state.active.value} name={this.state.active.label}/>

I don't understand how if there is an entry for styles how VS Code still tells me there is no such thing?

roberthchapman avatar Nov 01 '18 12:11 roberthchapman

I can't tell you either. Just a user who likes to help out, but I've never used react-select with TS. The property is definitely defined in the descriptor files, according to that repository. I couldn't tell you why VSCode isn't recognizing that.

cutterbl avatar Nov 01 '18 12:11 cutterbl

ok, thanks for trying to help. It's an infuriating issue as it's something so basic that just doesn't work, but don't know if it's affecting other people at all

roberthchapman avatar Nov 01 '18 12:11 roberthchapman

@roberthchapman you're not the only one having this issue - i'm also having the same issue. seems like when i installed @types/react-select i have something quite different than what i expected in my node modules than what shows from the link posted above

a fix for this would be very nice.

kaityhallman avatar Nov 06 '18 21:11 kaityhallman

Hello -

In an effort to sustain the react-select project going forward, we're closing old issues.

We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our efforts towards the current major version.

If you aren't using the latest version of react-select please consider upgrading to see if it resolves any issues you're having.

However, if you feel this issue is still relevant and you'd like us to review it - please leave a comment and we'll do our best to get back to you!

bladey avatar May 28 '20 01:05 bladey