MCPcopy
hub / github.com/JedWatson/react-select / componentDidMount

Method componentDidMount

packages/react-select/src/Select.tsx:797–823  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

795 };
796 }
797 componentDidMount() {
798 this.startListeningComposition();
799 this.startListeningToTouch();
800
801 if (this.props.closeMenuOnScroll && document && document.addEventListener) {
802 // Listen to all scroll events, and filter them out inside of 'onScroll'
803 document.addEventListener('scroll', this.onScroll, true);
804 }
805
806 if (this.props.autoFocus) {
807 this.focusInput();
808 }
809
810 // Scroll focusedOption into view if menuIsOpen is set on mount (e.g. defaultMenuIsOpen)
811 if (
812 this.props.menuIsOpen &&
813 this.state.focusedOption &&
814 this.menuListRef &&
815 this.focusedOptionRef
816 ) {
817 scrollIntoView(this.menuListRef, this.focusedOptionRef);
818 }
819 if (isAppleDevice()) {
820 // eslint-disable-next-line react/no-did-mount-set-state
821 this.setState({ isAppleDevice: true });
822 }
823 }
824 componentDidUpdate(prevProps: Props<Option, IsMulti, Group>) {
825 const { isDisabled, menuIsOpen } = this.props;
826 const { isFocused } = this.state;

Callers

nothing calls this directly

Calls 5

startListeningToTouchMethod · 0.95
focusInputMethod · 0.95
scrollIntoViewFunction · 0.90
isAppleDeviceFunction · 0.90

Tested by

no test coverage detected