forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Temporary fix for grabbing wrong rAF polyfill in ReactScheduler (face…
…book#12837) * Temporary fix for grabbing wrong rAF polyfill in ReactScheduler **what is the change?:** For now... We need to grab a slightly different implementation of rAF internally at FB than in Open Source. Making rAF a dependency of the ReactScheduler module allows us to fork the dependency at FB. NOTE: After this lands we have an alternative plan to make this module separate from React and require it before our Facebook timer polyfills are applied. But want to land this now to keep master in a working state and fix bugs folks are seeing at Facebook. Thanks @sebmarkbage @acdlite and @sophiebits for discussing the options and trade-offs for solving this issue. **why make this change?:** This fixes a problem we're running into when experimenting with ReactScheduler internally at Facebook, **and* it's part of our long term plan to use dependency injection with the scheduler to make it easier to test and adjust. **test plan:** Ran tests, lint, flow, and will manually test when syncing into Facebook's codebase. **issue:** See internal task T29442940 * ran prettier
- Loading branch information
Showing
4 changed files
with
52 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/shared/forks/requestAnimationFrameForReact.www.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters