File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/core/src/components/Picker/dropdown Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import PickerInputContainer from "../PickerInputContainer";
1515import DropDownPickerComponent from "react-native-dropdown-picker" ;
1616import { withTheme } from "../../../theming" ;
1717import PickerItem , { PickerItemProps } from "./PickerItem" ;
18+ import { useOnUpdate } from "../../../hooks" ;
1819
1920const DropDownPicker : React . FC <
2021 React . PropsWithChildren <
@@ -42,8 +43,8 @@ const DropDownPicker: React.FC<
4243} ) => {
4344 const [ pickerVisible , setPickerVisible ] = React . useState ( false ) ;
4445 const [ internalValue , setInternalValue ] = React . useState <
45- string | number | ( string | number ) [ ]
46- > ( ) ;
46+ string | number | ( string | number ) [ ] | undefined
47+ > ( value ) ;
4748
4849 const isMultiSelect = Array . isArray ( value ) ;
4950
@@ -70,12 +71,11 @@ const DropDownPicker: React.FC<
7071 [ optionsProp ]
7172 ) ;
7273
73- React . useEffect ( ( ) => {
74+ useOnUpdate ( ( ) => {
7475 onValueChange ?.(
7576 ( isMultiSelect ? internalValue ?? [ ] : internalValue ?? "" ) as any // cannot determine if multiselect or not on compile time
7677 ) ;
7778 // onValueChange excluded to prevent running on every re-render when using an anoymous function, which is the common case
78- // eslint-disable-next-line react-hooks/exhaustive-deps
7979 } , [ internalValue ] ) ;
8080
8181 React . useEffect ( ( ) => {
You can’t perform that action at this time.
0 commit comments