Skip to content

Commit

Permalink
fix: πŸ› πŸ› replace defaultProps with useDefaultProps (#2380)
Browse files Browse the repository at this point in the history
  • Loading branch information
li-jia-nan authored Jul 26, 2023
1 parent 78975b1 commit 166801d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { getTransitionParams } from './utils/transition';
import useMutationObserver from '../_util/useMutationObserver';
import useWindowSize from '../_util/useWindowSize';
import { popupDefaultProps } from './defaultProps';
import useDefaultProps from '../hooks/useDefaultProps';

export interface PopupProps extends TdPopupProps {
// ζ˜―ε¦θ§¦ε‘ε±•εΌ€ζ”Άθ΅·εŠ¨η”»οΌŒε†…ιƒ¨δΈ‹ζ‹‰εΌη»„δ»Άδ½Ώη”¨
Expand All @@ -34,7 +35,8 @@ export interface PopupRef {
getPortalElement: () => HTMLDivElement;
}

const Popup = forwardRef((props: PopupProps, ref: React.RefObject<PopupRef>) => {
const Popup = forwardRef<PopupRef, PopupProps>((originalProps, ref) => {
const props = useDefaultProps<PopupProps>(originalProps, popupDefaultProps);
const {
trigger,
content,
Expand Down Expand Up @@ -228,6 +230,5 @@ const Popup = forwardRef((props: PopupProps, ref: React.RefObject<PopupRef>) =>
});

Popup.displayName = 'Popup';
Popup.defaultProps = popupDefaultProps;

export default Popup;

0 comments on commit 166801d

Please sign in to comment.