We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f12ee3a + 7664ec9 commit 12da7b1Copy full SHA for 12da7b1
src/QueueAnim.jsx
@@ -1,6 +1,20 @@
1
import React, { createElement, cloneElement } from 'react';
2
import { findDOMNode } from 'react-dom';
3
-import velocity from 'velocity-animate';
+
4
+let velocity;
5
+if ( typeof document !== 'undefined' && typeof window !== 'undefined' ) {
6
+ // only load velocity on the client
7
+ velocity = require('velocity-animate');
8
+} else {
9
+ // provide a velocity stub for the server
10
+ velocity = function velocityServerDummy() {
11
+ const callback = arguments[arguments.length - 1];
12
+ // call after stack flushes
13
+ // in case you app depends on the asyncron nature of this function
14
+ setImmediate(function() { callback(); });
15
+ };
16
+}
17
18
import {
19
toArrayChildren,
20
findChildInChildrenByKey,
0 commit comments