Skip to content

Commit

Permalink
fix: nodeRef prop type for cross-realm elements (#732)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist authored May 29, 2021
1 parent 7b23603 commit 8710c01
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 8710c01

Please sign in to comment.