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

Add option to show new creatable item as first or last option #48

Open
Stenerson opened this issue Dec 15, 2016 · 7 comments
Open

Add option to show new creatable item as first or last option #48

Stenerson opened this issue Dec 15, 2016 · 7 comments

Comments

@Stenerson
Copy link

Hello,
I'm not sure what your general policy is for making changes to react-select-plus that are not already merged upstream into react-select but I thought I'd try anyway! 😎

Sometimes I'd like to discourage my users from creating a new option without at least looking through the list for similar options. In this case, I'd like the new "creatable" option to be last, rather than first.

I created a PR in react-select (JedWatson/react-select#1436) for this but I'm also using react-select-plus and it would be very useful for me to have it here.

The key change is adding a boolean prop to Creatable and use either unshift as it's currently doing or use push based on the prop here.

if (showNewOptionAtTop) {
  filteredOptions.unshift(this._createPlaceholderOption);
} else {
  filteredOptions.push(this._createPlaceholderOption);
}

Please let me know what you think. I'd be happy to fork and create a PR but I don't want to duplicate my changes here if you'd rather wait for them to merge it upstream.

Thanks!

@TrevorBurnham
Copy link
Contributor

Generally I wait to see what happens in the upstream project first, so I'll keep an eye on JedWatson/react-select#1436.

@Stenerson
Copy link
Author

10-4 Thanks @TrevorBurnham

react-select is so good and so popular but issues and PRs have been piling up as Jed is busy with other projects. I'm not sure what our best approach is as a community right now. 🤔

@TrevorBurnham
Copy link
Contributor

I hear you.

@dhiraj2602
Copy link

When are you planning to add the allowCreate option for the new release? I dont want to play much with the code so that I can be in sync with your repo.

@Stenerson
Copy link
Author

I'm using the Creatable HOC in the currently released version and it works great. This issue is just to add an option to have the new option at the bottom of the list. Today it gets unshift-ed into the list as the first item.

@dhiraj2602
Copy link

Creatable HOC is supported in the current version of React-select but I am using React-Select-Plus in which it is not supported in the latest version (1.0.0) as of now. Sorry if I am wrong, but kind of using 2 types of plugin because of the same issue.

@Stenerson
Copy link
Author

@dhiraj2602, What I was intending to say is that I'm using React-Select-Plus and Createable is indeed supported in 1.0.0-rc.1.patch3 which is the latest version.

See Pull #42

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

No branches or pull requests

3 participants