( element: ReactElement, fiber: null | Fiber, returnFiber: Fiber, )
| 228 | // We do this here instead of BeginWork because the Fragment fiber doesn't have |
| 229 | // the whole props object, only the children and is shared with arrays. |
| 230 | function validateFragmentProps( |
| 231 | element: ReactElement, |
| 232 | fiber: null | Fiber, |
| 233 | returnFiber: Fiber, |
| 234 | ) { |
| 235 | if (__DEV__) { |
| 236 | const keys = Object.keys(element.props); |
| 237 | for (let i = 0; i < keys.length; i++) { |
| 238 | const key = keys[i]; |
| 239 | if ( |
| 240 | key !== 'children' && |
| 241 | key !== 'key' && |
| 242 | (enableFragmentRefs ? key !== 'ref' : true) |
| 243 | ) { |
| 244 | if (fiber === null) { |
| 245 | // For unkeyed root fragments without refs (enableFragmentRefs), |
| 246 | // there's no Fiber. We create a fake one just for error stack handling. |
| 247 | fiber = createFiberFromElement(element, returnFiber.mode, 0); |
| 248 | if (__DEV__) { |
| 249 | fiber._debugInfo = currentDebugInfo; |
| 250 | } |
| 251 | fiber.return = returnFiber; |
| 252 | } |
| 253 | runWithFiberInDEV( |
| 254 | fiber, |
| 255 | erroredKey => { |
| 256 | if (enableFragmentRefs) { |
| 257 | console.error( |
| 258 | 'Invalid prop `%s` supplied to `React.Fragment`. ' + |
| 259 | 'React.Fragment can only have `key`, `ref`, and `children` props.', |
| 260 | erroredKey, |
| 261 | ); |
| 262 | } else { |
| 263 | console.error( |
| 264 | 'Invalid prop `%s` supplied to `React.Fragment`. ' + |
| 265 | 'React.Fragment can only have `key` and `children` props.', |
| 266 | erroredKey, |
| 267 | ); |
| 268 | } |
| 269 | }, |
| 270 | key, |
| 271 | ); |
| 272 | break; |
| 273 | } |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | function unwrapThenable<T>(thenable: Thenable<T>): T { |
| 279 | const index = thenableIndexCounter; |
no test coverage detected