|
1 | 1 | import classnames from 'classnames'; |
2 | 2 | import getScrollBarSize from 'rc-util/lib/getScrollBarSize'; |
3 | 3 | import KeyCode from 'rc-util/lib/KeyCode'; |
4 | | -import switchScrollingEffect from 'rc-util/lib/switchScrollingEffect'; |
5 | 4 | import * as React from 'react'; |
6 | 5 | import { polyfill } from 'react-lifecycles-compat'; |
7 | 6 |
|
@@ -121,7 +120,7 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> { |
121 | 120 | } |
122 | 121 |
|
123 | 122 | public componentWillUnmount() { |
124 | | - const { getOpenCount, open } = this.props; |
| 123 | + const { getOpenCount, open, switchScrollingEffect } = this.props; |
125 | 124 | const openCount = typeof getOpenCount === 'function' && getOpenCount() |
126 | 125 | delete currentDrawer[this.drawerId]; |
127 | 126 | if (open) { |
@@ -306,7 +305,7 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> { |
306 | 305 | } |
307 | 306 |
|
308 | 307 | private addScrollingEffect = (right: number) => { |
309 | | - const { placement, duration, ease, getOpenCount } = this.props; |
| 308 | + const { placement, duration, ease, getOpenCount, switchScrollingEffect } = this.props; |
310 | 309 | const openCount = getOpenCount && getOpenCount(); |
311 | 310 | if (openCount === 1) { |
312 | 311 | switchScrollingEffect(); |
@@ -337,7 +336,7 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> { |
337 | 336 | } |
338 | 337 |
|
339 | 338 | private remScrollingEffect = (right: number) => { |
340 | | - const { placement, duration, ease, getOpenCount } = this.props; |
| 339 | + const { placement, duration, ease, getOpenCount, switchScrollingEffect } = this.props; |
341 | 340 | const openCount = getOpenCount && getOpenCount(); |
342 | 341 | if (!openCount) { |
343 | 342 | switchScrollingEffect(true); |
@@ -456,6 +455,7 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> { |
456 | 455 | onHandleClick, |
457 | 456 | keyboard, |
458 | 457 | getOpenCount, |
| 458 | + switchScrollingEffect, |
459 | 459 | ...props |
460 | 460 | } = this.props; |
461 | 461 | // 首次渲染都将是关闭状态。 |
|
0 commit comments