Skip to content

Commit

Permalink
fix console errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jsladerman committed Jan 6, 2025
1 parent 44d3c60 commit ef21cf4
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/components/ArrowScroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,11 @@ function ArrowScroll({ children, ...props }: { children?: any }) {
onScroll: checkScroll,
ref: (node: HTMLElement) => {
containerRef.current = node
if (children.ref) {
if (typeof children.ref === 'function') {
children.ref(node)
} else if (children.ref) {
children.ref.current = node
if (children?.props?.ref) {
if (typeof children.props.ref === 'function') {
children.props.ref(node)
} else if (children.props.ref) {
children.props.ref.current = node
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/Highlight.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {
type ComponentPropsWithoutRef,
type RefObject,
useEffect,
useMemo,
useRef,
Expand Down Expand Up @@ -151,7 +152,7 @@ type HighlightProps = Omit<ComponentPropsWithoutRef<'pre'>, 'children'> & {
language?: string
showLineNumbers?: boolean
children: string
ref?: React.Ref<any>
ref?: RefObject<HTMLDivElement>
}

function Highlight({
Expand Down
2 changes: 1 addition & 1 deletion src/components/ListBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function Option({ item, state }: any) {
focused: isFocused,
labelProps,
descriptionProps,
ref: mergeRefs([ref, item.rendered.ref]),
ref: mergeRefs([ref, item?.rendered?.props?.ref]),
})

return cloneElement(item.rendered, mergedProps)
Expand Down
7 changes: 3 additions & 4 deletions src/components/TabPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
type ComponentProps,
type ReactElement,
type Ref,
type RefObject,
cloneElement,
useCallback,
useEffect,
Expand Down Expand Up @@ -40,7 +39,7 @@ type Mode = 'multipanel' | 'singlepanel'
export type WrappedTabPanelProps = DivProps & {
stateRef: TabStateRef
renderer?: Renderer
as: ReactElement<any> & { ref?: RefObject<any> }
as: ReactElement<any>
mode?: Mode
tabKey?: Key
}
Expand Down Expand Up @@ -112,7 +111,7 @@ function WrappedTabPanel({

return (
<TabPanelClone
tabRef={mergeRefs(as.ref, ref)}
tabRef={mergeRefs(as.props?.ref, ref)}
cloneAs={as}
{...mergedProps}
/>
Expand Down Expand Up @@ -180,7 +179,7 @@ function TabPanel({

return (
<TabPanelClone
tabRef={as.ref}
tabRef={as.props?.ref}
cloneAs={as}
>
{props.children}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ function Tooltip({

// Preserve the consumer's ref
const childrenRef = useMemo(
() => mergeRefs([reference, (children as any).ref]),
() => mergeRefs([reference, children.props?.ref]),
[reference, children]
)

Expand Down

0 comments on commit ef21cf4

Please sign in to comment.