diff --git a/components/_util/responsiveObserve.ts b/components/_util/responsiveObserve.ts index e017c802a7..f0318eb409 100644 --- a/components/_util/responsiveObserve.ts +++ b/components/_util/responsiveObserve.ts @@ -1,5 +1,6 @@ export type Breakpoint = 'xxl' | 'xl' | 'lg' | 'md' | 'sm' | 'xs'; export type BreakpointMap = Partial>; +export type ScreenMap = Partial>; export const responsiveArray: Breakpoint[] = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs']; @@ -12,7 +13,7 @@ export const responsiveMap: BreakpointMap = { xxl: '(min-width: 1600px)', }; -type SubscribeFunc = (screens: BreakpointMap) => void; +type SubscribeFunc = (screens: ScreenMap) => void; let subscribers: Array<{ token: string; @@ -23,7 +24,7 @@ let screens = {}; const responsiveObserve = { matchHandlers: {}, - dispatch(pointMap: BreakpointMap) { + dispatch(pointMap: ScreenMap) { screens = pointMap; if (subscribers.length < 1) { return false; diff --git a/components/descriptions/index.tsx b/components/descriptions/index.tsx index beae4c8adb..db339983a1 100644 --- a/components/descriptions/index.tsx +++ b/components/descriptions/index.tsx @@ -4,7 +4,7 @@ import toArray from 'rc-util/lib/Children/toArray'; import warning from '../_util/warning'; import ResponsiveObserve, { Breakpoint, - BreakpointMap, + ScreenMap, responsiveArray, } from '../_util/responsiveObserve'; import { ConfigConsumer, ConfigConsumerProps } from '../config-provider'; @@ -168,7 +168,7 @@ const defaultColumnMap = { class Descriptions extends React.Component< DescriptionsProps, { - screens: BreakpointMap; + screens: ScreenMap; } > { static defaultProps: DescriptionsProps = { @@ -179,7 +179,7 @@ class Descriptions extends React.Component< static Item: typeof DescriptionsItem = DescriptionsItem; state: { - screens: BreakpointMap; + screens: ScreenMap; } = { screens: {}, }; diff --git a/components/grid/__tests__/__snapshots__/demo.test.js.snap b/components/grid/__tests__/__snapshots__/demo.test.js.snap index 37eb045530..9c071ced42 100644 --- a/components/grid/__tests__/__snapshots__/demo.test.js.snap +++ b/components/grid/__tests__/__snapshots__/demo.test.js.snap @@ -487,11 +487,11 @@ exports[`renders ./components/grid/demo/gutter.md correctly 1`] = `
{ } export interface RowState { - screens: BreakpointMap; + screens: ScreenMap; } export default class Row extends React.Component { @@ -30,7 +30,14 @@ export default class Row extends React.Component { }; state: RowState = { - screens: {}, + screens: { + xs: true, + sm: true, + md: true, + lg: true, + xl: true, + xxl: true, + }, }; token: string;