hoaphantn7604/react-native-element-dropdown

onChange event not firing

tocallaghan opened this issue · 0 comments

Info
react-native: 0.72.5
react-native-element-dropdown: 2.12.1

Description
When selecting an item from the drop down, the selected item does not get populated. The onChange event doesn't fire.

This is wrapped in a react-hook-form, and I thought it possibly could have something to do with their onChange event being destructured and a possible naming collision, so I renamed that onChangeReactHook. Still no dice.

I've also moved the <Dropdown .... /> outside of the form and the onChange is still not firing. I don't know, I'm at a loss to be honest. Any insight would be greatly appreciated.

<Controller 
  control={methods.control}
  name={'itemDesc'}
  render={({ field: { onChange: onChangeReactHook, value } }) => 
    <>
      <Dropdown 
        data={[{'name':'item', 'id':0}]}
        valueField={'id'}
        labelField={'name'}
        value={value}
        mode='modal'
        placeholder={'Select an item'}
        onChange={ item  =>{  console.log('selected' , item )}}
      />
    </>
  }

/>