Skip to content

Commit

Permalink
Pass focusedOption to the MenuList. This is useful for handling scrol…
Browse files Browse the repository at this point in the history
…ling when overridng MenuList with a virtualized list from react-virtualized
  • Loading branch information
sunniejai committed Jan 16, 2019
1 parent d35fd8d commit 08aac4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -1453,7 +1453,7 @@ export default class Select extends Component<Props, State> {

if (isMulti) {
const selectValues: Array<any> = selectValue.map(opt => {
let isFocused = opt === focusedValue;
const isOptionFocused = opt === focusedValue;
return (
<MultiValue
{...commonProps}
Expand All @@ -1462,7 +1462,7 @@ export default class Select extends Component<Props, State> {
Label: MultiValueLabel,
Remove: MultiValueRemove,
}}
isFocused={isFocused}
isFocused={isOptionFocused}
isDisabled={isDisabled}
key={this.getOptionValue(opt)}
removeProps={{
Expand Down Expand Up @@ -1698,6 +1698,7 @@ export default class Select extends Component<Props, State> {
innerRef={this.getMenuListRef}
isLoading={isLoading}
maxHeight={maxHeight}
focusedOption={focusedOption}
>
{menuUI}
</MenuList>
Expand Down
2 changes: 2 additions & 0 deletions src/components/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {
MenuPlacement,
MenuPosition,
CommonProps,
OptionType
} from '../types';
import type { Theme } from '../types';

Expand Down Expand Up @@ -342,6 +343,7 @@ export type MenuListProps = {
children: Node,
/** Inner ref to DOM Node */
innerRef: InnerRef,
focusedOption: OptionType
};
export type MenuListComponentProps = CommonProps &
MenuListProps &
Expand Down

0 comments on commit 08aac4c

Please sign in to comment.