File tree Expand file tree Collapse file tree 4 files changed +102
-0
lines changed Expand file tree Collapse file tree 4 files changed +102
-0
lines changed Original file line number Diff line number Diff line change 1+ /** 
2+  * Copyright (c) Facebook, Inc. and its affiliates. 
3+  * 
4+  * This source code is licensed under the MIT license found in the 
5+  * LICENSE file in the root directory of this source tree. 
6+  * 
7+  * @flow  
8+  */ 
9+ 
10+ 'use strict' ; 
11+ 
12+ export  { 
13+   isValidElementType , 
14+   typeOf , 
15+   ContextConsumer , 
16+   ContextProvider , 
17+   Element , 
18+   ForwardRef , 
19+   Fragment , 
20+   Lazy , 
21+   Memo , 
22+   Portal , 
23+   Profiler , 
24+   StrictMode , 
25+   Suspense , 
26+   unstable_SuspenseList , 
27+   isAsyncMode , 
28+   isConcurrentMode , 
29+   isContextConsumer , 
30+   isContextProvider , 
31+   isElement , 
32+   isForwardRef , 
33+   isFragment , 
34+   isLazy , 
35+   isMemo , 
36+   isPortal , 
37+   isProfiler , 
38+   isStrictMode , 
39+   isSuspense , 
40+   unstable_isSuspenseList , 
41+ }  from  './src/ReactIs' ; 
Original file line number Diff line number Diff line change 1+ /** 
2+  * Copyright (c) Facebook, Inc. and its affiliates. 
3+  * 
4+  * This source code is licensed under the MIT license found in the 
5+  * LICENSE file in the root directory of this source tree. 
6+  * 
7+  * @flow  
8+  */ 
9+ 
10+ 'use strict' ; 
11+ 
12+ export  { 
13+   isValidElementType , 
14+   typeOf , 
15+   ContextConsumer , 
16+   ContextProvider , 
17+   Element , 
18+   ForwardRef , 
19+   Fragment , 
20+   Lazy , 
21+   Memo , 
22+   Portal , 
23+   Profiler , 
24+   StrictMode , 
25+   Suspense , 
26+   isAsyncMode , 
27+   isConcurrentMode , 
28+   isContextConsumer , 
29+   isContextProvider , 
30+   isElement , 
31+   isForwardRef , 
32+   isFragment , 
33+   isLazy , 
34+   isMemo , 
35+   isPortal , 
36+   isProfiler , 
37+   isStrictMode , 
38+   isSuspense , 
39+ }  from  './src/ReactIs' ; 
Original file line number Diff line number Diff line change @@ -72,6 +72,7 @@ export const Portal = REACT_PORTAL_TYPE;
7272export  const  Profiler  =  REACT_PROFILER_TYPE ; 
7373export  const  StrictMode  =  REACT_STRICT_MODE_TYPE ; 
7474export  const  Suspense  =  REACT_SUSPENSE_TYPE ; 
75+ export  const  unstable_SuspenseList  =  REACT_SUSPENSE_LIST_TYPE ; 
7576
7677export  { isValidElementType } ; 
7778
@@ -142,3 +143,6 @@ export function isStrictMode(object: any) {
142143export  function  isSuspense ( object : any )  { 
143144  return  typeOf ( object )  ===  REACT_SUSPENSE_TYPE ; 
144145} 
146+ export  function  unstable_isSuspenseList ( object : any )  { 
147+   return  typeOf ( object )  ===  REACT_SUSPENSE_LIST_TYPE ; 
148+ } 
Original file line number Diff line number Diff line change @@ -186,6 +186,24 @@ describe('ReactIs', () => {
186186    expect ( ReactIs . isSuspense ( < div  /> ) ) . toBe ( false ) ; 
187187  } ) ; 
188188
189+   // @gate  experimental 
190+   it ( 'should identify suspense list' ,  ( )  =>  { 
191+     expect ( ReactIs . isValidElementType ( React . unstable_SuspenseList ) ) . toBe ( true ) ; 
192+     expect ( ReactIs . typeOf ( < React . unstable_SuspenseList  /> ) ) . toBe ( 
193+       ReactIs . unstable_SuspenseList , 
194+     ) ; 
195+     expect ( 
196+       ReactIs . unstable_isSuspenseList ( < React . unstable_SuspenseList  /> ) , 
197+     ) . toBe ( true ) ; 
198+     expect ( 
199+       ReactIs . unstable_isSuspenseList ( { type : ReactIs . unstable_SuspenseList } ) , 
200+     ) . toBe ( false ) ; 
201+     expect ( ReactIs . unstable_isSuspenseList ( 'React.unstable_SuspenseList' ) ) . toBe ( 
202+       false , 
203+     ) ; 
204+     expect ( ReactIs . unstable_isSuspenseList ( < div  /> ) ) . toBe ( false ) ; 
205+   } ) ; 
206+ 
189207  it ( 'should identify profile root' ,  ( )  =>  { 
190208    expect ( ReactIs . isValidElementType ( React . Profiler ) ) . toBe ( true ) ; 
191209    expect ( 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments