|
1 | 1 | /* eslint react/prop-types: 0 */
|
| 2 | +import omit from 'rc-util/lib/omit'; |
2 | 3 | import * as React from 'react';
|
3 |
| -import OriginCSSMotion from './CSSMotion'; |
4 | 4 | import type { CSSMotionProps } from './CSSMotion';
|
5 |
| -import { supportTransition } from './util/motion'; |
| 5 | +import OriginCSSMotion from './CSSMotion'; |
| 6 | +import type { KeyObject } from './util/diff'; |
6 | 7 | import {
|
| 8 | + diffKeys, |
| 9 | + parseKeys, |
7 | 10 | STATUS_ADD,
|
8 | 11 | STATUS_KEEP,
|
9 | 12 | STATUS_REMOVE,
|
10 | 13 | STATUS_REMOVED,
|
11 |
| - diffKeys, |
12 |
| - parseKeys, |
13 | 14 | } from './util/diff';
|
14 |
| -import type { KeyObject } from './util/diff'; |
| 15 | +import { supportTransition } from './util/motion'; |
| 16 | +import pick from './util/pick'; |
15 | 17 |
|
16 | 18 | const MOTION_PROP_NAMES = [
|
17 | 19 | 'eventProps',
|
@@ -127,16 +129,11 @@ export function genCSSMotionList(
|
127 | 129 | } = this.props;
|
128 | 130 |
|
129 | 131 | const Component = component || React.Fragment;
|
130 |
| - |
131 |
| - const motionProps: CSSMotionProps = {}; |
132 |
| - MOTION_PROP_NAMES.forEach(prop => { |
133 |
| - motionProps[prop] = restProps[prop]; |
134 |
| - delete restProps[prop]; |
135 |
| - }); |
136 |
| - delete restProps.keys; |
| 132 | + const motionProps = pick(restProps, MOTION_PROP_NAMES as any); |
| 133 | + const componentProps = omit(restProps, MOTION_PROP_NAMES as any); |
137 | 134 |
|
138 | 135 | return (
|
139 |
| - <Component {...restProps}> |
| 136 | + <Component {...componentProps}> |
140 | 137 | {keyEntities.map(({ status, ...eventProps }) => {
|
141 | 138 | const visible = status === STATUS_ADD || status === STATUS_KEEP;
|
142 | 139 | return (
|
|
0 commit comments