File tree Expand file tree Collapse file tree 3 files changed +37
-13
lines changed Expand file tree Collapse file tree 3 files changed +37
-13
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,22 @@ if (__DEV__) {
62
62
var warning = require ( 'fbjs/lib/warning' ) ;
63
63
var validateDOMNesting = require ( 'validateDOMNesting' ) ;
64
64
var { updatedAncestorInfo} = validateDOMNesting ;
65
+
66
+ if (
67
+ typeof Map !== 'function' ||
68
+ Map . prototype == null ||
69
+ typeof Map . prototype . forEach !== 'function' ||
70
+ typeof Set !== 'function' ||
71
+ Set . prototype == null ||
72
+ typeof Set . prototype . clear !== 'function' ||
73
+ typeof Set . prototype . forEach !== 'function'
74
+ ) {
75
+ warning (
76
+ false ,
77
+ 'React depends on Map and Set built-in types. Make sure that you load a ' +
78
+ 'polyfill in older browsers. http://fb.me/react-polyfills' ,
79
+ ) ;
80
+ }
65
81
}
66
82
67
83
require ( 'ReactDOMClientInjection' ) ;
Original file line number Diff line number Diff line change 22
22
23
23
import type { Deadline } from 'ReactFiberReconciler' ;
24
24
25
- var invariant = require ( 'fbjs/lib/invariant' ) ;
26
25
var ExecutionEnvironment = require ( 'fbjs/lib/ExecutionEnvironment' ) ;
27
26
27
+ if ( __DEV__ ) {
28
+ var warning = require ( 'fbjs/lib/warning' ) ;
29
+
30
+ if (
31
+ ExecutionEnvironment . canUseDOM &&
32
+ typeof requestAnimationFrame !== 'function'
33
+ ) {
34
+ warning (
35
+ false ,
36
+ 'React depends on requestAnimationFrame. Make sure that you load a ' +
37
+ 'polyfill in older browsers. http://fb.me/react-polyfills' ,
38
+ ) ;
39
+ }
40
+ }
41
+
28
42
// TODO: There's no way to cancel, because Fiber doesn't atm.
29
43
let rIC : ( callback : ( deadline : Deadline ) => void ) => number ;
30
44
@@ -39,12 +53,6 @@ if (!ExecutionEnvironment.canUseDOM) {
39
53
} ) ;
40
54
return 0 ;
41
55
} ;
42
- } else if ( typeof requestAnimationFrame !== 'function' ) {
43
- invariant (
44
- false ,
45
- 'React depends on requestAnimationFrame. Make sure that you load a ' +
46
- 'polyfill in older browsers.' ,
47
- ) ;
48
56
} else if ( typeof requestIdleCallback !== 'function' ) {
49
57
// Polyfill requestIdleCallback.
50
58
Original file line number Diff line number Diff line change @@ -15,16 +15,16 @@ const ReactDOMFeatureFlags = require('ReactDOMFeatureFlags');
15
15
const describeFiber = ReactDOMFeatureFlags . useFiber ? describe : xdescribe ;
16
16
17
17
describeFiber ( 'ReactDOMFrameScheduling' , ( ) => {
18
- it ( 'throws when requestAnimationFrame is not polyfilled in the browser' , ( ) => {
18
+ it ( 'warns when requestAnimationFrame is not polyfilled in the browser' , ( ) => {
19
19
const previousRAF = global . requestAnimationFrame ;
20
20
try {
21
21
global . requestAnimationFrame = undefined ;
22
22
jest . resetModules ( ) ;
23
- expect ( ( ) => {
24
- require ( 'react-dom' ) ;
25
- } ) . toThrow (
26
- 'React depends on requestAnimationFrame. Make sure that you load a ' +
27
- 'polyfill in older browsers .',
23
+ spyOn ( console , 'error' ) ;
24
+ require ( 'react-dom' ) ;
25
+ expect ( console . error . calls . count ( ) ) . toBe ( 1 ) ;
26
+ expect ( console . error . calls . argsFor ( 0 ) [ 0 ] ) . toContain (
27
+ 'React depends on requestAnimationFrame .',
28
28
) ;
29
29
} finally {
30
30
global . requestAnimationFrame = previousRAF ;
You can’t perform that action at this time.
0 commit comments