Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit dadfaac

Browse files
committedMar 25, 2025·
Add getComputedStyle helper to ViewTransition refs
This is also sometimes useful to read the style of the pseudo-element itself without an animation.
1 parent 4845e16 commit dadfaac

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
@@ -2079,6 +2079,7 @@ export function stopGestureTransition(transition: RunningGestureTransition) {
20792079
interface ViewTransitionPseudoElementType extends Animatable {
20802080
_scope: HTMLElement;
20812081
_selector: string;
2082+
getComputedStyle(): CSSStyleDeclaration;
20822083
}
20832084

20842085
function ViewTransitionPseudoElement(
@@ -2132,6 +2133,14 @@ ViewTransitionPseudoElement.prototype.getAnimations = function (
21322133
}
21332134
return result;
21342135
};
2136+
// $FlowFixMe[prop-missing]
2137+
ViewTransitionPseudoElement.prototype.getComputedStyle = function (
2138+
this: ViewTransitionPseudoElementType,
2139+
): CSSStyleDeclaration {
2140+
const scope = this._scope;
2141+
const selector = this._selector;
2142+
return getComputedStyle(scope, selector);
2143+
};
21352144

21362145
export function createViewTransitionInstance(
21372146
name: string,

0 commit comments

Comments
 (0)
Please sign in to comment.