Skip to content

Commit

Permalink
fix: transition SSR (#619)
Browse files Browse the repository at this point in the history
* Support SSR

* Update src/Transition.js

* rm whitespace

Co-authored-by: Jason Quense <[email protected]>
  • Loading branch information
perrin4869 and jquense authored May 6, 2020
1 parent 46bdb6e commit 2722bb6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Transition.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,11 @@ Transition.propTypes = {
* (see
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
*/
nodeRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
nodeRef: PropTypes.shape({
current: typeof Element === 'undefined'
? PropTypes.any
: PropTypes.instanceOf(Element)
}),

/**
* A `function` child can be used instead of a React element. This function is
Expand Down
10 changes: 10 additions & 0 deletions test/SSR-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* @jest-environment node
*/

// test that import does not crash
import * as ReactTransitionGroup from '../src'; // eslint-disable-line no-unused-vars

describe('SSR', () => {
it('should import react-transition-group in node env', () => {});
});

0 comments on commit 2722bb6

Please sign in to comment.