MCPcopy Create free account
hub / github.com/reactstrap/reactstrap / componentDidMount

Function componentDidMount

src/Offcanvas.js:109–128  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

107 }
108
109 componentDidMount() {
110 const { isOpen, autoFocus, onEnter } = this.props;
111
112 if (isOpen) {
113 this.init();
114 this.setState({ isOpen: true });
115 if (autoFocus) {
116 this.setFocus();
117 }
118 }
119
120 if (onEnter) {
121 onEnter();
122 }
123
124 // traps focus inside the Offcanvas, even if the browser address bar is focused
125 document.addEventListener('focus', this.trapFocus, true);
126
127 this._isMounted = true;
128 }
129
130 componentDidUpdate(prevProps, prevState) {
131 if (this.props.isOpen && !prevProps.isOpen) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…