ant-design/components/config-provider/DisabledContext.tsx
lijianan ea8ed28209
chore: unified import method (#42149)
* chore: unified import method

* fix lint
2023-05-05 20:52:44 +08:00

22 lines
572 B
TypeScript

import React from 'react';
export type DisabledType = boolean | undefined;
const DisabledContext = React.createContext<DisabledType>(false);
export interface DisabledContextProps {
disabled?: DisabledType;
children?: React.ReactNode;
}
export const DisabledContextProvider: React.FC<DisabledContextProps> = ({ children, disabled }) => {
const originDisabled = React.useContext(DisabledContext);
return (
<DisabledContext.Provider value={disabled ?? originDisabled}>
{children}
</DisabledContext.Provider>
);
};
export default DisabledContext;