JedWatson / JedWatson/react-select
how to apply extra element at the top of all list
Open
Nobody has claimed this yet.
issue/bug-unconfirmed
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
I used custom component for options.
const Option = (props) => {
return (
<components.Option {...props}>
<input
type="checkbox"
checked={props.isSelected}
onChange={() => null}
/>{" "}
<label>{props.label}</label>
</components.Option>
);
};
so here's the code I want to wrap all option in single element, to do so i did below
const Option = (props) => {
return (
<InfiniteScroll
// className="row"
dataLength={virtualTours.tour}
next={fetchMoreDataForInfiniteVRtour}
hasMore={virtualTours.setHasMoreVirtualTour}
loader={virtualTours.tour.length > 25 ?<h4>Loading...</h4>: ""}
endMessage={
<p style={{ textAlign: "center" }}>
</p>
}
scrollThreshold= "300px"
scrollableTarget= "react-select-2-listbox"
>
<components.Option {...props}>
<input
type="checkbox"
checked={props.isSelected}
onChange={() => null}
/>{" "}
<label>{props.label}</label>
</components.Option>
</InfiniteScroll>
);
};
but it wrapped each option with `InfiniteScroll`, but i don't want wrapped each `option`
I want like this
<InfiniteScroll
// className="row"
dataLength={virtualTours.tour}
next={fetchMoreDataForInfiniteVRtour}
hasMore={virtualTours.setHasMoreVirtualTour}
loader={virtualTours.tour.length > 25 ?<h4>Loading...</h4>: ""}
endMessage={
<p style={{ textAlign: "center" }}>
</p>
}
scrollThreshold= "300px"
scrollableTarget= "react-select-2-listbox"
>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</InfiniteScroll>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the custom Option example in the issue and review react-select's component customization documentation and list-rendering entry points. Determine whether a list-level wrapper can be supported instead of wrapping each option; done means documenting or specifying the supported approach, with any relevant example or test identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100