We are using v1.0.0-rc2
while using Creatable, the onChange payload includes the promptText in the payload.value attribute .
import React from 'react';
import { Creatable } from 'react-select';
class Demo extends React.Component {
render() {
return (
<Creatable onChange={(payload) => console.log(payload.value)} />
);
}
}
value turns out to be the full Create option "${label}" instead of just label
We are passing promptTextCreator={(name) => name} to by pass the issue
I'm also running into this bug; the above workaround works, but it's less than satisfactory as custom prompt text is no longer possible.
Hello,
Can you explain why you closed this issue? The problem does happen in 1.0.0-rc2 version.
IMHO it should be reopened.
I close this as I found that its because our implementation that passing incorrect shouldKeyDownEventCreateNewOption, passing correct function like shouldKeyDownEventCreateNewOption={({ keyCode }) => keyCode === 13} then I didn't see the bug
Reopen as other seeing the same issues
Seems to be fixed in 1.0.0-rc3.
I just ran into this issue and I am using 1.0.0-rc3, however the solution from @roderickhsiao seems to fix the problem. I was not using shouldKeyDownEventCreateNewOption previously.
I'm in 1.0.0-rc.2 and ran into the issue and like @roderickhsiao and @purplesquirrels said, using shouldKeyDownEventCreateNewOption function should fix it.
Thanks guys
note that you'll probably want to respond to keyCode === 9 to handle Tab keys
This is still happening for me in 1.2.1 when I use react-select inside redux form. I tried to provide shouldKeyDownEventCreateNewOption function but it did not help. After some debugging I found out that this condition: if (option === this._createPlaceholderOption) in onOptionSelect of Creatable is never true for me.
Hello -
In an effort to sustain the react-select project going forward, we're closing old issues / pull requests.
We understand this might be inconvenient but in the best interest of supporting the broader community we have to direct our limited efforts to maintain the latest 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.
If you feel this issue / pull request 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.