Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow container ref with null and undefined for useResize #2091

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions docs/app/data/fixtures.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,14 @@ export const USE_SCROLL_CONFIG_DATA: CellData[][] = [
),
]

export const USE_RESIZE_CONFIG_DATA: CellData[][] = [
['container', 'React.MutableRefObject<HTMLElement | null | undefined>', null],
...DEFAULT_CONFIG_DATA.filter(
row =>
row[0] !== 'from' && typeof row[0] === 'object' && row[0]?.label !== 'to'
),
]

export const USESPRINGVALUE_CONFIG_DATA: CellData[][] = [
[
{
Expand Down
4 changes: 2 additions & 2 deletions docs/app/routes/docs/utilities/use-resize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ function MyComponent() {
## Reference

import { TablesConfiguration } from '~/components/Tables/TablesConfig'
import { USE_SCROLL_CONFIG_DATA } from '~/data/fixtures'
import { USE_RESIZE_CONFIG_DATA } from '~/data/fixtures'

<TablesConfiguration data={USE_SCROLL_CONFIG_DATA} />
<TablesConfiguration data={USE_RESIZE_CONFIG_DATA} />

## Typescript

Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/useResize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SpringProps, SpringValues } from '../types'
import { useSpring } from './useSpring'

export interface UseResizeOptions extends Omit<SpringProps, 'to' | 'from'> {
container?: MutableRefObject<HTMLElement>
container?: MutableRefObject<HTMLElement | null | undefined>
}

/**
Expand Down