Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
childBsPrefix,
// Need to define the default "as" during prop destructuring to be compatible with styled-components github.com/react-bootstrap/react-bootstrap/issues/3595
as: Component = Button,
...props
},
ref,
) => {
const prefix = useBootstrapPrefix(bsPrefix, 'dropdown-toggle');
if (childBsPrefix !== undefined) {
props.bsPrefix = childBsPrefix;
}
const [toggleProps, { toggle }] = useDropdownToggle();
toggleProps.ref = useMergedRefs(
toggleProps.ref,
useWrappedRefWithWarning(ref, 'DropdownToggle'),
);
// This intentionally forwards size and variant (if set) to the
// underlying component, to allow it to render size and style variants.
return (
{children}
);
const Overlay = React.forwardRef((props, outerRef) => {
const {
flip,
placement,
containerPadding,
popperConfig = {},
transition: Transition,
} = props;
const [rootElement, attachRef] = useCallbackRef();
const [arrowElement, attachArrowRef] = useCallbackRef();
const mergedRef = useMergedRefs(attachRef, outerRef);
const container = useWaitForDOMRef(props.container);
const target = useWaitForDOMRef(props.target);
const [exited, setExited] = useState(!props.show);
const { modifiers = {} } = popperConfig;
const { styles, arrowStyles, ...popper } = usePopper(target, rootElement, {
...popperConfig,
placement: placement || 'bottom',
enableEvents: props.show,
modifiers: {
...modifiers,
preventOverflow: {
padding: containerPadding || 5,