Skip to content

Commit

Permalink
fix: onBlur typing
Browse files Browse the repository at this point in the history
  • Loading branch information
kevin9foong committed Oct 21, 2024
1 parent 8dd0649 commit b6b8852
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
import { ChangeHandler } from 'react-hook-form'
import { VirtuosoHandle } from 'react-virtuoso'
import {
FormControlOptions,
Expand All @@ -25,7 +24,7 @@ export interface SingleSelectProviderProps<
value: string
/** Controlled selected item onChange handler */
onChange: (value: string) => void
onBlur?: (() => void) | ChangeHandler
onBlur?: () => void
/** Function based on which items in dropdown are filtered. Default filter filters by fuzzy match. */
filter?: (items: Item[], value: string) => Item[]
/** Initial dropdown opened state. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ const ChildrenBody = ({
const {
ref: childNameRegisterRef,
onChange: selectOnChange,
onBlur: selectOnBlur,
...selectRest
} = register(childNamePath, validationRules)

Expand Down Expand Up @@ -421,6 +422,7 @@ const ChildrenBody = ({
case MyInfoChildAttributes.ChildGender:
case MyInfoChildAttributes.ChildRace:
case MyInfoChildAttributes.ChildSecondaryRace: {
const { onBlur, ...rest } = register(fieldPath, validationRules)
return (
<FormControl
key={key}
Expand All @@ -432,7 +434,7 @@ const ChildrenBody = ({
{MYINFO_ATTRIBUTE_MAP[subField].description}
</FormLabel>
<SingleSelect
{...register(fieldPath, validationRules)}
{...rest}
value={value}
items={
MYINFO_ATTRIBUTE_MAP[subField].fieldOptions as string[]
Expand Down

0 comments on commit b6b8852

Please sign in to comment.