How to use the @fluentui/react-component-ref.isRefObject function in @fluentui/react-component-ref

To help you get started, we’ve selected a few @fluentui/react-component-ref examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / fluent-ui-react / packages / react / src / utils / positioner / Popper.tsx View on Github external
const createInstance = React.useCallback(() => {
    destroyInstance()

    const reference =
      targetRef && isRefObject(targetRef)
        ? (targetRef as React.RefObject<element>).current
        : (targetRef as _PopperJS.ReferenceObject)

    if (!enabled || !reference || !contentRef.current) {
      return
    }

    const pointerTargetRefElement = pointerTargetRef &amp;&amp; pointerTargetRef.current
    const scrollParentElement = getScrollParent(contentRef.current)
    const popperHasScrollableParent = scrollParentElement !== scrollParentElement.ownerDocument.body

    const modifiers: PopperJS.Modifiers = _.merge(
      { preventOverflow: { padding: 0 } },
      { flip: { padding: 0, flipVariationsByContent: true } },
      /**
       * This prevents blurrines in chrome, when the coordinates are odd numbers</element>

@fluentui/react-component-ref

A set of components and utils to deal with React refs.

MIT
Latest version published 11 months ago

Package Health Score

88 / 100
Full package analysis