Skip to content

Commit

Permalink
feat(useDark): passthrough default handler from useColorSchema (#2866)
Browse files Browse the repository at this point in the history
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
  • Loading branch information
godismyjudge95 and antfu committed Mar 28, 2023
1 parent 55a32d9 commit d6d35a0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/useDark/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export interface UseDarkOptions extends Omit<UseColorModeOptions<BasicColorSchem
*
* @default undefined
*/
onChanged?: (isDark: boolean) => void
onChanged?: (isDark: boolean, defaultHandler: ((mode: BasicColorSchema) => void), mode: BasicColorSchema) => void
}

/**
Expand All @@ -45,7 +45,7 @@ export function useDark(options: UseDarkOptions = {}) {
...options,
onChanged: (mode, defaultHandler) => {
if (options.onChanged)
options.onChanged?.(mode === 'dark')
options.onChanged?.(mode === 'dark', defaultHandler, mode)
else
defaultHandler(mode)
},
Expand Down

0 comments on commit d6d35a0

Please sign in to comment.