Skip to content

Commit f134b39

Browse files
authored
Add getComputedStyle helper to ViewTransition refs (#32751)
This is also sometimes useful to read the style of the pseudo-element itself without an animation.
1 parent fceb0f8 commit f134b39

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

packages/react-dom-bindings/src/client/ReactFiberConfigDOM.js

+9
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,7 @@ export function stopViewTransition(transition: RunningViewTransition) {
20852085
interface ViewTransitionPseudoElementType extends Animatable {
20862086
_scope: HTMLElement;
20872087
_selector: string;
2088+
getComputedStyle(): CSSStyleDeclaration;
20882089
}
20892090

20902091
function ViewTransitionPseudoElement(
@@ -2138,6 +2139,14 @@ ViewTransitionPseudoElement.prototype.getAnimations = function (
21382139
}
21392140
return result;
21402141
};
2142+
// $FlowFixMe[prop-missing]
2143+
ViewTransitionPseudoElement.prototype.getComputedStyle = function (
2144+
this: ViewTransitionPseudoElementType,
2145+
): CSSStyleDeclaration {
2146+
const scope = this._scope;
2147+
const selector = this._selector;
2148+
return getComputedStyle(scope, selector);
2149+
};
21412150

21422151
export function createViewTransitionInstance(
21432152
name: string,

0 commit comments

Comments
 (0)