Skip to content

Commit 2117a46

Browse files
Alicia Lopezjquense
Alicia Lopez
andcommitted
fix: transition SSR (#619)
* Support SSR * Update src/Transition.js * rm whitespace Co-authored-by: Jason Quense <monastic.panic@gmail.com>
1 parent a0760c8 commit 2117a46

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/Transition.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,11 @@ Transition.propTypes = {
390390
* (see
391391
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
392392
*/
393-
nodeRef: PropTypes.shape({ current: PropTypes.instanceOf(Element) }),
393+
nodeRef: PropTypes.shape({
394+
current: typeof Element === 'undefined'
395+
? PropTypes.any
396+
: PropTypes.instanceOf(Element)
397+
}),
394398

395399
/**
396400
* A `function` child can be used instead of a React element. This function is

test/SSR-test.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* @jest-environment node
3+
*/
4+
5+
// test that import does not crash
6+
import * as ReactTransitionGroup from '../src'; // eslint-disable-line no-unused-vars
7+
8+
describe('SSR', () => {
9+
it('should import react-transition-group in node env', () => {});
10+
});

0 commit comments

Comments
 (0)