Skip to content

Commit ef040a6

Browse files
committed
feat: drawerchildren function
1 parent c1b43b1 commit ef040a6

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

src/DrawerChild.tsx

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ import {
2222

2323
const currentDrawer: Record<string, boolean> = {};
2424

25-
// interface IState {
26-
// _self: DrawerChild;
27-
// prevProps?: IDrawerChildProps;
28-
// }
29-
3025
interface Point {
3126
x: number;
3227
y: number;
@@ -63,32 +58,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
6358
...rest
6459
} = props;
6560
const { autoFocus } = props;
66-
// public static getDerivedStateFromProps(
67-
// props: IDrawerChildProps,
68-
// { prevProps, _self }: { prevProps: IDrawerChildProps; _self: DrawerChild },
69-
// ) {
70-
// const nextState = {
71-
// prevProps: props,
72-
// };
73-
// if (prevProps !== undefined) {
74-
// const { placement, level } = props;
75-
// if (placement !== prevProps.placement) {
76-
// // test 的 bug, 有动画过场,删除 dom
77-
// _self.contentDom = null;
78-
// }
79-
// if (level !== prevProps.level) {
80-
// _self.getLevelDom(props);
81-
// }
82-
// }
83-
// return nextState;
84-
// }
85-
86-
// constructor(props: IDrawerChildProps) {
87-
// super(props);
88-
// this.state = {
89-
// _self: this,
90-
// };
91-
// }
9261
const passive = useRef<{ passive: boolean } | boolean>();
9362
const levelDom = useRef<HTMLElement[]>();
9463
const dom = useRef<HTMLDivElement>(null);
@@ -116,7 +85,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
11685
} catch (err) {}
11786
passive.current = passiveSupported ? { passive: false } : false;
11887
}
119-
// const { open, getContainer, showMask, autoFocus } = this.props;
12088
const container = getParent(getContainer);
12189
drawerId.current = `drawer_id_${Number(
12290
(Date.now() + Math.random())
@@ -232,7 +200,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
232200
};
233201

234202
const onWrapperTransitionEnd = (e: React.TransitionEvent) => {
235-
// const { open, afterVisibleChange } = this.props;
236203
if (
237204
e.target === contentWrapper.current &&
238205
e.propertyName.match(/transform$/)
@@ -252,7 +219,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
252219
};
253220

254221
const openLevelTransition = () => {
255-
// const { open, width, height } = this.props;
256222
const { isHorizontal, placementName } = getHorizontalBoolAndPlacementName();
257223
const contentValue = contentDom.current
258224
? contentDom.current.getBoundingClientRect()[
@@ -269,7 +235,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
269235
value?: string | number,
270236
right?: number,
271237
) => {
272-
// const { placement, levelMove, duration, ease, showMask } = this.props;
273238
// router 切换时可能会导至页面失去滚动条,所以需要时时获取。
274239
levelDom.current?.forEach(dom => {
275240
dom.style.transition = `transform ${duration} ${ease}`;
@@ -298,7 +263,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
298263
placementName?: string,
299264
value?: string | number,
300265
) => {
301-
// const { onChange } = this.props;
302266
if (!windowIsUndefined) {
303267
const right =
304268
document.body.scrollHeight >
@@ -315,7 +279,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
315279
};
316280

317281
const toggleScrollingToDrawerAndBody = (right: number) => {
318-
// const { getContainer, showMask, open } = this.props;
319282
const container = getParent(getContainer);
320283
// 处理 body 滚动
321284
if (container && container.parentNode === document.body && showMask) {
@@ -365,7 +328,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
365328
};
366329

367330
const addScrollingEffect = (right: number) => {
368-
// const { placement, duration, ease } = this.props;
369331
const widthTransition = `width ${duration} ${ease}`;
370332
const transformTransition = `transform ${duration} ${ease}`;
371333
dom.current.style.transition = 'none';
@@ -391,8 +353,6 @@ const DrawerChild = (props: IDrawerChildProps) => {
391353
};
392354

393355
const remScrollingEffect = (right: number) => {
394-
// const { placement, duration, ease } = this.props;
395-
396356
if (transitionStr) {
397357
document.body.style.overflowX = 'hidden';
398358
}

0 commit comments

Comments
 (0)