src/index.tsx
changed.
Showing 1 of 1 files from the diff.
@@ -79,6 +79,12 @@
Loading
79 | 79 | * Resolve the promise returned by {@link NiceModalHandler.hide | hide} method. |
|
80 | 80 | */ |
|
81 | 81 | resolveHide: (args?: unknown) => void; |
|
82 | + | ||
83 | + | /** |
|
84 | + | * Resolves the promise returned by {@link NiceModalHandler.show | show} method with value `false`, |
|
85 | + | * then removes the modal using the {@link NiceModalHandler.remove | remove} method. |
|
86 | + | */ |
|
87 | + | resolveFalseAndRemove: () => void; |
|
82 | 88 | } |
|
83 | 89 | ||
84 | 90 | // Omit will not work if extends Record<string, unknown>, which is not needed here |
@@ -339,6 +345,11 @@
Loading
339 | 345 | }, |
|
340 | 346 | [mid], |
|
341 | 347 | ); |
|
348 | + | const resolveFalseAndRemove = useCallback(() => { |
|
349 | + | const modalResolve = modalCallbacks[mid].resolve; |
|
350 | + | modalResolve(false); |
|
351 | + | remove(mid); |
|
352 | + | }, [mid]); |
|
342 | 353 | ||
343 | 354 | return { |
|
344 | 355 | id: mid, |
@@ -351,6 +362,7 @@
Loading
351 | 362 | resolve: resolveCallback, |
|
352 | 363 | reject: rejectCallback, |
|
353 | 364 | resolveHide, |
|
365 | + | resolveFalseAndRemove, |
|
354 | 366 | }; |
|
355 | 367 | } |
|
356 | 368 | export const create = <P extends {}>(Comp: React.ComponentType<P>): React.FC<P & NiceModalHocProps> => { |
Files | Coverage |
---|---|
src/index.tsx | 98.54% |
Project Totals (1 files) | 98.54% |
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.