Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions packages/react-scheduler/src/ReactScheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,20 +39,7 @@ type CallbackConfigType = {|
|};

import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
import warning from 'fbjs/lib/warning';

if (__DEV__) {
if (
ExecutionEnvironment.canUseDOM &&
typeof requestAnimationFrame !== 'function'
) {
warning(
false,
'React depends on requestAnimationFrame. Make sure that you load a ' +
'polyfill in older browsers. https://fb.me/react-polyfills',
);
}
}
import requestAnimationFrameForReact from 'shared/requestAnimationFrameForReact';

const hasNativePerformanceNow =
typeof performance === 'object' && typeof performance.now === 'function';
Expand Down Expand Up @@ -232,7 +219,7 @@ if (!ExecutionEnvironment.canUseDOM) {
if (!isAnimationFrameScheduled) {
// Schedule another animation callback so we retry later.
isAnimationFrameScheduled = true;
requestAnimationFrame(animationTick);
requestAnimationFrameForReact(animationTick);
}
}
};
Expand Down Expand Up @@ -298,7 +285,7 @@ if (!ExecutionEnvironment.canUseDOM) {
// might want to still have setTimeout trigger scheduleWork as a backup to ensure
// that we keep performing work.
isAnimationFrameScheduled = true;
requestAnimationFrame(animationTick);
requestAnimationFrameForReact(animationTick);
}
return newCallbackId;
};
Expand Down
10 changes: 10 additions & 0 deletions packages/shared/forks/requestAnimationFrameForReact.www.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

'use strict';

export default require('requestAnimationFrameForReact');
28 changes: 28 additions & 0 deletions packages/shared/requestAnimationFrameForReact.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

'use strict';

import ExecutionEnvironment from 'fbjs/lib/ExecutionEnvironment';
import warning from 'fbjs/lib/warning';

if (__DEV__) {
if (
ExecutionEnvironment.canUseDOM &&
typeof requestAnimationFrame !== 'function'
) {
warning(
false,
'React depends on requestAnimationFrame. Make sure that you load a ' +
'polyfill in older browsers. https://fb.me/react-polyfills',
);
}
}

export default requestAnimationFrame;
11 changes: 11 additions & 0 deletions scripts/rollup/forks.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ const forks = Object.freeze({
return null;
},

// This logic is forked on www to use the 'acrossTransitions' version.
'shared/requestAnimationFrameForReact': (bundleType, entry) => {
switch (bundleType) {
case FB_WWW_DEV:
case FB_WWW_PROD:
return 'shared/forks/requestAnimationFrameForReact.www.js';
default:
return null;
}
},

// This logic is forked on www to blacklist warnings.
'shared/lowPriorityWarning': (bundleType, entry) => {
switch (bundleType) {
Expand Down