n4kz / react-native-material-dropdown

Material dropdown with consistent behaviour on iOS and Android
Other
732 stars 597 forks source link

Unable to setState in hooks #189

Open moazkh60 opened 4 years ago

moazkh60 commented 4 years ago

I am unable to set the drop down value onChangeText{value => setValue(value)} when I console log the value it's working and returning perfect value. It's just not setting it to the hook. Here is the definition of hook

const [value, setValue] = useState()

it's like setValue function is never called for some reason. Please check this issue ASAP.

mgmanoj commented 4 years ago

@moazkh60 try this onChangeText={(value,index,data)=>this.setState({'something':data[index].yourkey})}