Skip to content

Commit

Permalink
Fixed nodeRef prop type for cross-frame elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed May 27, 2021
1 parent ffa33d2 commit 77bec9b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/Transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,18 @@ Transition.propTypes = {
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
*/
nodeRef: PropTypes.shape({
current: typeof Element === 'undefined'
? PropTypes.any
: PropTypes.instanceOf(Element)
current:
typeof Element === "undefined"
? PropTypes.any
: (propValue, key, componentName, location, propFullName, secret) => {
const value = propValue[key];

return PropTypes.instanceOf(
value && "ownerDocument" in value
? value.ownerDocument.defaultView.Element
: Element
)(propValue, key, componentName, location, propFullName, secret);
}
}),

/**
Expand Down

0 comments on commit 77bec9b

Please sign in to comment.