-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
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
[SelectField] label bug #2446
Comments
You beat me to it.. I'd like to add..that in my case changing the selection does NOT remove the hint text. |
What version are you using? It seems that the issue is not present in the master branch. |
"material-ui": "^0.13.4" |
Could you try the master branch? This might be fixed. |
Use "0.14.0-rc1"? |
I would say master, we have recently changed the implementation of the |
Hi @oliviertassinari, I'm using 0.14.0-rc1 (npm version) and the problem wasn't fixed. |
@CezarLuiz0 Please wait for 0.14.0-rc2 and try again with that. |
See: #1427 (comment) |
@CezarLuiz0 Is this fixed with the |
I have just tried the examples of @CezarLuiz0 with the master branch. It's working correctly. <SelectField
hintText="Select the bicycle"
menuItems={[
{ payload: 0, text: 'Bike 01' },
{ payload: 1, text: 'Bike 02' },
{ payload: 2, text: 'Bike 03' },
{ payload: 3, text: 'Bike 04' },
]}
/> |
@CezarLuiz0 Can you share the SelectField source code? |
Sure! <SelectField
hintText="Selecionar a bike"
menuItems={[
{ payload: 0, text: 'Bike 01' },
{ payload: 1, text: 'Bike 02' },
{ payload: 2, text: 'Bike 03' },
{ payload: 3, text: 'Bike 04' },
]}
fullWidth
/> |
See my gif above, the selected item by the user changed, but for you, SelectField doesn't changed. My main problem is the label on the item and when I select an item, It doesn't get the selected color. In documentation, SelectField works fine 😕 |
I'm using the same source code than you. The result is completly different. |
Look my dependencies: "dependencies": {
"alt": "^0.18.0",
"classnames": "^2.2.1",
"flexboxgrid": "^6.3.0",
"history": "^1.13.1",
"lodash": "^3.10.1",
"material-ui": "^0.14.0-rc2",
"normalize.css": "^3.0.3",
"react": "^0.14.0",
"react-addons-css-transition-group": "^0.14.3",
"react-addons-test-utils": "^0.14.0",
"react-dom": "^0.14.0",
"react-notification-system": "^0.2.6",
"react-router": "^1.0.2",
"react-tap-event-plugin": "^0.2.1",
"react-toolbox": "^0.13.4",
"rest-mapper": "^1.2.2"
} |
We'll release 0.14.0 very soon 😁 Check back after the release and see if it's fixed @oliviertassinari Thanks for the confirmation 👍 👍 |
I'm using 0.14.0 and I had a lot of trouble getting the SelectField to work. I was having the same problem with the label above. Here is an example of how I fixed it: getInitialState(){
return {
selectValue: ''
};
},
render() {
const cats = ['Maine Coon','Siamese','Abyssinian','Sphynx','Himalayan','Bengal'];
let categories = _.map(cats, function(cat, idx){
return <MenuItem value={cat} key={idx} primaryText={cat}/>
});
return (
<SelectField
value={this.state.selectValue}
onChange={this._handleSelectValueChange}
floatingLabelText="Category">
{categories}
</SelectField>
)
},
_handleSelectValueChange(event, index, value){
this.setState({selectValue: value});
}, Key is necessary or else you get console warnings. PrimaryText is what is displayed in the DropDown. Value is necessary to avoid the label bug and make the field operate properly. Also, floatingLabelText and hintText cannot be used at the same time. |
@rdagger Thanks for the code example. Yeah I can confirm this issue. We'll try to look into it as soon as we can. |
Can confirm |
Any solution? I'm using version 0.14.2 and the issue wasn't fixed. Thanks! |
Hi guys, I'm using version 0.14.2: My component: <SelectField
floatingLabelText="Categoria"
onChange={this.changeCategory}
required
fullWidth
>
<MenuItem value={1} key={1} primaryText="Urbano" />
<MenuItem value={2} key={2} primaryText="Ciclismo" />
<MenuItem value={3} key={3} primaryText="Mountain Bike" />
</SelectField> Any solution for this? Thanks guys! |
@cezarlz A workaround is to provide a |
Thanks! Is resolving my problem for while. |
@oliviertassinari : This is still happening on the docs website as well. |
any progress with this yet? |
As far as I have investigated, this issue is pretty related to #4275. |
@oliviertassinari Component <SelectField
hintText = {this.props.hintText}
onChange = {this.props.onChange}
value = {this.props.value}>
{this.props.menuItems.map((item, i)=>{
return <MenuItem key={i} value={'value'+i} primaryText={'primaryText'+1} label={'label'+i}/>
})}
</SelectField> 2 Fixes possible
<SelectField hintStyle = {{backgroundColor: '#ffffff', zIndex: 1, pointerEvents: 'none', width: '85%'}}/>
Give a className <SelectField className="select" ... /> Target the hintText and add the following style .select{
> div:first-child{
background: white !important; // same color as your page
z-index: 1; // goes on top
pointer-events: none; // don't block the click
width: 85%, // be larger than the primaryTexts behind, but do not cover the little arraw on the right
}
} |
I am having this problem with version 1.3.0 |
My code:
The text was updated successfully, but these errors were encountered: