TypeError when providing default value in DropDownPicker
See original GitHub issueI am creating a dropdown picker with remote search enabled. And for the default value I am using value from the redux state. But upon app refresh, I am getting the following error,
TypeError: _value.includes is not a function. (In '_value.includes(item[_schema.value])', '_value.includes' is undefined)
Current Usage:
<DropDownPicker
addCustomItem={true}
disableLocalSearch={true}
items={currentMeta.meta}
open={pickerState && pickerState[metaKey]}
onChangeSearchText={
(searchKey) => handleRemoteDropDownSearch(
searchKey, currentMeta
)
}
onOpen={() => handleDropDownOpen(metaKey)}
onClose={() => handleDropDownClose()}
placeholder={currentMeta.placeholder}
{...getDropDownStyles(currentMeta.meta.length)}
searchable={true}
searchPlaceholder={'Start typing...'}
setValue={
(newValue) => handleDropDownChange(
currentMeta.stateKey, newValue()
)
}
value={userData[currentMeta.stateKey]}
zIndex={2000}
{...dropDownSearchStyles}
/>
userData has key-values as per the key from currentMeta.stateKey
E.g. If currentMeta.stateKey is university then userData[currentMeta.stateKey] return My University (string)
It would be great if someone can help on this
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
react-native-dropdown-picker default value - Stack Overflow
Your question is not clear, you can use the value field the array to match with the default value, can you explain your...
Read more >Unable to select multiple values · Issue #389 - GitHub
When I select one option they throw me this error: TypeError: ... defaultValue[0]') in react-native-dropdown-picker in version ^3.8.3 please ...
Read more >Usage | React Native Dropdown Picker - GitHub Pages
This only works with multiple item pickers. Type, Default. number, null. max . Specifies the maximum number of items.
Read more >[Solved]-default value comes first useState-React Native
const [countryCode, setCountryCode] = useState< PhoneInputProps['defaultCode'] | string | null >(); useEffect(() => { (async () => { const { status } ...
Read more >react-native-picker-select | Yarn - Package Manager
For iOS, by default we are wrapping an unstyled TextInput component. You can then pass down styles to customize it to your needs....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The callback was returning
undefinedbecause you’d not passed the current value. in therenderListItemmethodundefined.includeswas complaining.Thank you so much. I am using redux and I was looking for this answer everywhere.