Skip to content

Commit fac55cc

Browse files
committed
fix: add context file
1 parent 09a8ddd commit fac55cc

File tree

3 files changed

+22
-19
lines changed

3 files changed

+22
-19
lines changed

src/Overflow.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ import useLayoutEffect from 'rc-util/lib/hooks/useLayoutEffect';
66
import Item from './Item';
77
import useEffectState, { useBatcher } from './hooks/useEffectState';
88
import type { ComponentType } from './RawItem';
9-
import RawItem, { OverflowContext } from './RawItem';
9+
import RawItem from './RawItem';
10+
import { OverflowContext } from './context';
1011

1112
const RESPONSIVE = 'responsive' as const;
1213
const INVALIDATE = 'invalidate' as const;
1314

14-
export { OverflowContext } from './RawItem';
15+
export { OverflowContext } from './context';
1516

1617
export type { ComponentType } from './RawItem';
1718

src/RawItem.tsx

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,14 @@
11
import * as React from 'react';
22
import classNames from 'classnames';
33
import Item from './Item';
4+
import { OverflowContext } from './context';
45

56
export type ComponentType =
67
| React.ComponentType<any>
78
| React.ForwardRefExoticComponent<any>
89
| React.FC<any>
910
| keyof React.ReactHTML;
1011

11-
export const OverflowContext = React.createContext<{
12-
prefixCls: string;
13-
responsive: boolean;
14-
order: number;
15-
registerSize: (key: React.Key, width: number | null) => void;
16-
display: boolean;
17-
18-
invalidate: boolean;
19-
20-
// Item Usage
21-
item?: any;
22-
itemKey?: React.Key;
23-
24-
// Rest Usage
25-
className?: string;
26-
}>(null);
27-
2812
export interface RawItemProps extends React.HTMLAttributes<any> {
2913
component?: ComponentType;
3014
children?: React.ReactNode;

src/context.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import React from 'react';
2+
3+
export const OverflowContext = React.createContext<{
4+
prefixCls: string;
5+
responsive: boolean;
6+
order: number;
7+
registerSize: (key: React.Key, width: number | null) => void;
8+
display: boolean;
9+
10+
invalidate: boolean;
11+
12+
// Item Usage
13+
item?: any;
14+
itemKey?: React.Key;
15+
16+
// Rest Usage
17+
className?: string;
18+
}>(null);

0 commit comments

Comments
 (0)