Skip to content

Commit 1948187

Browse files
committed
Add "auto" class to mean the built-in should run
1 parent f50e9de commit 1948187

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

packages/react-reconciler/src/ReactFiberViewTransitionComponent.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,14 @@ import {getIsHydrating} from './ReactFiberHydrationContext';
2121
import {getTreeId} from './ReactFiberTreeContext';
2222

2323
export type ViewTransitionClassPerType = {
24-
[transitionType: 'default' | string]: 'none' | string,
24+
[transitionType: 'default' | string]: 'none' | 'auto' | string,
2525
};
2626

27-
export type ViewTransitionClass = 'none' | string | ViewTransitionClassPerType;
27+
export type ViewTransitionClass =
28+
| 'none'
29+
| 'auto'
30+
| string
31+
| ViewTransitionClassPerType;
2832

2933
export type ViewTransitionProps = {
3034
name?: string,
@@ -127,7 +131,10 @@ export function getViewTransitionClassName(
127131
const className: ?string = getClassNameByType(defaultClass);
128132
const eventClassName: ?string = getClassNameByType(eventClass);
129133
if (eventClassName == null) {
130-
return className;
134+
return className === 'auto' ? null : className;
135+
}
136+
if (eventClassName === 'auto') {
137+
return null;
131138
}
132139
return eventClassName;
133140
}

0 commit comments

Comments
 (0)