Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#48 7 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
javascript, react
Ambito
frontend

Direzione di ricerca

Inizia in src/Creatable.js, nel punto di inserimento dell'opzione intorno alla riga 122, e verifica come il componente Creatable espone le props. Aggiungi la scelta booleana richiesta per posizionare la nuova opzione creatable per prima o per ultima, quindi verifica che ogni impostazione produca l'ordine previsto delle opzioni.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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!

Lingua principale
JavaScript
Stelle
284
Fork
90
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di HubSpot/react-select-plus

Tutte le issue di HubSpot/react-select-plus

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.