From 08aac4c1875e29c1af74e4f6c0d69fc0d1e183ce Mon Sep 17 00:00:00 2001 From: Sunny Li Date: Wed, 16 Jan 2019 17:32:55 -0500 Subject: [PATCH] Pass focusedOption to the MenuList. This is useful for handling scrolling when overridng MenuList with a virtualized list from react-virtualized --- src/Select.js | 5 +++-- src/components/Menu.js | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Select.js b/src/Select.js index 534a041ef6..9319e0a75c 100644 --- a/src/Select.js +++ b/src/Select.js @@ -1453,7 +1453,7 @@ export default class Select extends Component { if (isMulti) { const selectValues: Array = selectValue.map(opt => { - let isFocused = opt === focusedValue; + const isOptionFocused = opt === focusedValue; return ( { Label: MultiValueLabel, Remove: MultiValueRemove, }} - isFocused={isFocused} + isFocused={isOptionFocused} isDisabled={isDisabled} key={this.getOptionValue(opt)} removeProps={{ @@ -1698,6 +1698,7 @@ export default class Select extends Component { innerRef={this.getMenuListRef} isLoading={isLoading} maxHeight={maxHeight} + focusedOption={focusedOption} > {menuUI} diff --git a/src/components/Menu.js b/src/components/Menu.js index 5ea1b6259f..875c32d5cc 100644 --- a/src/components/Menu.js +++ b/src/components/Menu.js @@ -22,6 +22,7 @@ import type { MenuPlacement, MenuPosition, CommonProps, + OptionType } from '../types'; import type { Theme } from '../types'; @@ -342,6 +343,7 @@ export type MenuListProps = { children: Node, /** Inner ref to DOM Node */ innerRef: InnerRef, + focusedOption: OptionType }; export type MenuListComponentProps = CommonProps & MenuListProps &