Skip to content

Commit

Permalink
Provide the inputValue and other props to the Option and optionRenderer
Browse files Browse the repository at this point in the history
Ref #784, closes #783
  • Loading branch information
JedWatson committed Nov 24, 2017
1 parent af6520b commit dd32c27
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
9 changes: 7 additions & 2 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
# React-Select

## ## v1.0.1 / 2017-11-24
## Unreleased

* more props are passed to the Option component: `focusOption`, `inputValue`, `selectValue`, `removeValue`
* the `inputValue` is passed as the third argument to the `optionRenderer`

## v1.0.1 / 2017-11-24

* reintroduced source files for scss and less stylesheets into the npm package

## ## v1.0.0 / 2017-11-23
## v1.0.0 / 2017-11-23

* reverted spacebar-selects-option behaviour for searchable selects, thanks [Charles Lee](https://github.com/gwyneplaine) - [see PR](https://github.com/JedWatson/react-select/pull/2163)
* fixed behaviour where async doesn't handle onInputChange returning a value, thanks [Anton](https://github.com/tehbi4) - [see PR](https://github.com/JedWatson/react-select/pull/2133)
Expand Down
12 changes: 10 additions & 2 deletions src/utils/defaultMenuRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ import React from 'react';

function menuRenderer ({
focusedOption,
focusOption,
inputValue,
instancePrefix,
labelKey,
onFocus,
onOptionRef,
onSelect,
optionClassName,
optionComponent,
optionRenderer,
options,
removeValue,
selectValue,
valueArray,
valueKey,
onOptionRef
}) {
let Option = optionComponent;

Expand All @@ -30,6 +34,8 @@ function menuRenderer ({
return (
<Option
className={optionClass}
focusOption={focusOption}
inputValue={inputValue}
instancePrefix={instancePrefix}
isDisabled={option.disabled}
isFocused={isFocused}
Expand All @@ -40,8 +46,10 @@ function menuRenderer ({
option={option}
optionIndex={i}
ref={ref => { onOptionRef(ref, isFocused); }}
removeValue={removeValue}
selectValue={selectValue}
>
{optionRenderer(option, i)}
{optionRenderer(option, i, inputValue)}
</Option>
);
});
Expand Down

0 comments on commit dd32c27

Please sign in to comment.