| 395 | } |
| 396 | |
| 397 | function useImperativeHandle<T>( |
| 398 | ref: {current: T | null} | ((inst: T | null) => mixed) | null | void, |
| 399 | create: () => T, |
| 400 | inputs: Array<mixed> | void | null, |
| 401 | ): void { |
| 402 | nextHook(); |
| 403 | // We don't actually store the instance anywhere if there is no ref callback |
| 404 | // and if there is a ref callback it might not store it but if it does we |
| 405 | // have no way of knowing where. So let's only enable introspection of the |
| 406 | // ref itself if it is using the object form. |
| 407 | let instance: ?T = undefined; |
| 408 | if (ref !== null && typeof ref === 'object') { |
| 409 | instance = ref.current; |
| 410 | } |
| 411 | hookLog.push({ |
| 412 | displayName: null, |
| 413 | primitive: 'ImperativeHandle', |
| 414 | stackError: new Error(), |
| 415 | value: instance, |
| 416 | debugInfo: null, |
| 417 | dispatcherHookName: 'ImperativeHandle', |
| 418 | }); |
| 419 | } |
| 420 | |
| 421 | function useDebugValue(value: any, formatterFn: ?(value: any) => any) { |
| 422 | hookLog.push({ |