|
11 | 11 | // When adding new symbols to this file, |
12 | 12 | // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' |
13 | 13 |
|
14 | | -import {enableSymbolFallbackForWWW} from './ReactFeatureFlags'; |
15 | | - |
16 | | -const usePolyfill = |
17 | | - enableSymbolFallbackForWWW && (typeof Symbol !== 'function' || !Symbol.for); |
18 | | - |
19 | 14 | // The Symbol used to tag the ReactElement-like types. |
20 | | -export const REACT_ELEMENT_TYPE = usePolyfill |
21 | | - ? 0xeac7 |
22 | | - : Symbol.for('react.element'); |
23 | | -export const REACT_PORTAL_TYPE = usePolyfill |
24 | | - ? 0xeaca |
25 | | - : Symbol.for('react.portal'); |
26 | | -export const REACT_FRAGMENT_TYPE = usePolyfill |
27 | | - ? 0xeacb |
28 | | - : Symbol.for('react.fragment'); |
29 | | -export const REACT_STRICT_MODE_TYPE = usePolyfill |
30 | | - ? 0xeacc |
31 | | - : Symbol.for('react.strict_mode'); |
32 | | -export const REACT_PROFILER_TYPE = usePolyfill |
33 | | - ? 0xead2 |
34 | | - : Symbol.for('react.profiler'); |
35 | | -export const REACT_PROVIDER_TYPE = usePolyfill |
36 | | - ? 0xeacd |
37 | | - : Symbol.for('react.provider'); |
38 | | -export const REACT_CONTEXT_TYPE = usePolyfill |
39 | | - ? 0xeace |
40 | | - : Symbol.for('react.context'); |
41 | | -export const REACT_SERVER_CONTEXT_TYPE = usePolyfill |
42 | | - ? 0xeae6 |
43 | | - : Symbol.for('react.server_context'); |
44 | | -export const REACT_FORWARD_REF_TYPE = usePolyfill |
45 | | - ? 0xead0 |
46 | | - : Symbol.for('react.forward_ref'); |
47 | | -export const REACT_SUSPENSE_TYPE = usePolyfill |
48 | | - ? 0xead1 |
49 | | - : Symbol.for('react.suspense'); |
50 | | -export const REACT_SUSPENSE_LIST_TYPE = usePolyfill |
51 | | - ? 0xead8 |
52 | | - : Symbol.for('react.suspense_list'); |
53 | | -export const REACT_MEMO_TYPE = usePolyfill ? 0xead3 : Symbol.for('react.memo'); |
54 | | -export const REACT_LAZY_TYPE = usePolyfill ? 0xead4 : Symbol.for('react.lazy'); |
55 | | -export const REACT_SCOPE_TYPE = usePolyfill |
56 | | - ? 0xead7 |
57 | | - : Symbol.for('react.scope'); |
58 | | -export const REACT_DEBUG_TRACING_MODE_TYPE = usePolyfill |
59 | | - ? 0xeae1 |
60 | | - : Symbol.for('react.debug_trace_mode'); |
61 | | -export const REACT_OFFSCREEN_TYPE = usePolyfill |
62 | | - ? 0xeae2 |
63 | | - : Symbol.for('react.offscreen'); |
64 | | -export const REACT_LEGACY_HIDDEN_TYPE = usePolyfill |
65 | | - ? 0xeae3 |
66 | | - : Symbol.for('react.legacy_hidden'); |
67 | | -export const REACT_CACHE_TYPE = usePolyfill |
68 | | - ? 0xeae4 |
69 | | - : Symbol.for('react.cache'); |
70 | | -export const REACT_TRACING_MARKER_TYPE = usePolyfill |
71 | | - ? 0xeae5 |
72 | | - : Symbol.for('react.tracing_marker'); |
73 | | -export const REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = usePolyfill |
74 | | - ? 0xeae7 |
75 | | - : Symbol.for('react.default_value'); |
76 | | -const MAYBE_ITERATOR_SYMBOL = usePolyfill |
77 | | - ? typeof Symbol === 'function' && Symbol.iterator |
78 | | - : Symbol.iterator; |
| 15 | +export const REACT_ELEMENT_TYPE = Symbol.for('react.element'); |
| 16 | +export const REACT_PORTAL_TYPE = Symbol.for('react.portal'); |
| 17 | +export const REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); |
| 18 | +export const REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); |
| 19 | +export const REACT_PROFILER_TYPE = Symbol.for('react.profiler'); |
| 20 | +export const REACT_PROVIDER_TYPE = Symbol.for('react.provider'); |
| 21 | +export const REACT_CONTEXT_TYPE = Symbol.for('react.context'); |
| 22 | +export const REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); |
| 23 | +export const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); |
| 24 | +export const REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); |
| 25 | +export const REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); |
| 26 | +export const REACT_MEMO_TYPE = Symbol.for('react.memo'); |
| 27 | +export const REACT_LAZY_TYPE = Symbol.for('react.lazy'); |
| 28 | +export const REACT_SCOPE_TYPE = Symbol.for('react.scope'); |
| 29 | +export const REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for( |
| 30 | + 'react.debug_trace_mode', |
| 31 | +); |
| 32 | +export const REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); |
| 33 | +export const REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden'); |
| 34 | +export const REACT_CACHE_TYPE = Symbol.for('react.cache'); |
| 35 | +export const REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker'); |
| 36 | +export const REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for( |
| 37 | + 'react.default_value', |
| 38 | +); |
79 | 39 |
|
| 40 | +const MAYBE_ITERATOR_SYMBOL = Symbol.iterator; |
80 | 41 | const FAUX_ITERATOR_SYMBOL = '@@iterator'; |
81 | 42 |
|
82 | 43 | export function getIteratorFn(maybeIterable: ?any): ?() => ?Iterator<*> { |
|
0 commit comments