(props: Props<Option, IsMulti, Group>)
| 684 | // ------------------------------ |
| 685 | |
| 686 | constructor(props: Props<Option, IsMulti, Group>) { |
| 687 | super(props); |
| 688 | this.state.instancePrefix = |
| 689 | 'react-select-' + (this.props.instanceId || ++instanceId); |
| 690 | this.state.selectValue = cleanValue(props.value); |
| 691 | // Set focusedOption if menuIsOpen is set on init (e.g. defaultMenuIsOpen) |
| 692 | if (props.menuIsOpen && this.state.selectValue.length) { |
| 693 | const focusableOptionsWithIds: FocusableOptionWithId<Option>[] = |
| 694 | this.getFocusableOptionsWithIds(); |
| 695 | const focusableOptions = this.buildFocusableOptions(); |
| 696 | const optionIndex = focusableOptions.indexOf(this.state.selectValue[0]); |
| 697 | this.state.focusableOptionsWithIds = focusableOptionsWithIds; |
| 698 | this.state.focusedOption = focusableOptions[optionIndex]; |
| 699 | this.state.focusedOptionId = getFocusedOptionId( |
| 700 | focusableOptionsWithIds, |
| 701 | focusableOptions[optionIndex] |
| 702 | ); |
| 703 | } |
| 704 | } |
| 705 | |
| 706 | static getDerivedStateFromProps( |
| 707 | props: Props<unknown, boolean, GroupBase<unknown>>, |
nothing calls this directly
no test coverage detected