MCPcopy Index your code
hub / github.com/reactstrap/reactstrap / render

Method render

src/Dropdown.js:301–374  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

299 }
300
301 render() {
302 const {
303 className,
304 cssModule,
305 direction,
306 isOpen,
307 group,
308 size,
309 nav,
310 setActiveFromChild,
311 active,
312 tag,
313 menuRole,
314 ...attrs
315 } = omit(this.props, ['toggle', 'disabled', 'inNavbar', 'a11y']);
316
317 const Tag = tag || (nav ? 'li' : 'div');
318
319 let subItemIsActive = false;
320 if (setActiveFromChild) {
321 React.Children.map(
322 this.props.children[1].props.children,
323 (dropdownItem) => {
324 if (dropdownItem && dropdownItem.props.active) subItemIsActive = true;
325 },
326 );
327 }
328
329 const classes = mapToCssModules(
330 classNames(
331 className,
332 nav && active ? 'active' : false,
333 setActiveFromChild && subItemIsActive ? 'active' : false,
334 {
335 'btn-group': group,
336 [`btn-group-${size}`]: !!size,
337 dropdown: !group,
338 dropup: direction === 'up',
339 dropstart: direction === 'start' || direction === 'left',
340 dropend: direction === 'end' || direction === 'right',
341 show: isOpen,
342 'nav-item': nav,
343 },
344 ),
345 cssModule,
346 );
347
348 if (this.context.insideInputGroup) {
349 return (
350 <DropdownContext.Provider value={this.getContextValue()}>
351 <Manager>
352 {React.Children.map(this.props.children, (child) =>
353 React.cloneElement(child, { onKeyDown: this.handleKeyDown }),
354 )}
355 </Manager>
356 </DropdownContext.Provider>
357 );
358 }

Callers

nothing calls this directly

Calls 2

omitFunction · 0.90
mapToCssModulesFunction · 0.90

Tested by

no test coverage detected