defaultValue not working?
See original GitHub issueHow can I set a default value in the picker? What I want is after the screen/component loads, there should be a value in the dropdown (without the user clicking the picker)
I have already tried setting a defaultValue props but it does not work.
const [defValue, setDefValue] = useState({ label: 'test', value: 'test'})
<DropDownPicker
listMode="SCROLLVIEW"
scrollViewProps={{
nestedScrollEnabled: true,
}}
zIndex={3000}
zIndexInverse={1000}
style={styles.field}
open={open2}
value={value}
items={leaveOptionDropDown}
setOpen={setOpen2}
setValue={setValue}
defaultValue={defValue}
onChangeValue={(value) => {
handleChange('type_of_leave')
setFieldValue('type_of_leave', value)
}}
/>
I have also tried setting a selected value in the items but it also does not work.
leaveOptionDropDown.push({
key: item.id,
label:item..first_name+" "+item.last_name,
value:item.id,
selected: {selected}
})
Issue Analytics
- State:
- Created a year ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
c# - DefaultValue attribute is not working with my Auto Property
The DefaultValue attribute is only used to tell the Visual Studio Designers (for example when designing a form) what the default value of...
Read more >DefaultValue not working | Optimizely Developer Community
Hello everyone. In a Block a [DefaultValue] is not working. It is an existing Block, existing properties [DefaultValue] is working fine.
Read more >Default value not working - WordPress.org
Hi – I have an optional custom field, “job type”, on a set of pages for which I am trying to set a...
Read more >Default value not work properly #2095 - GitHub
While I use mapstruct, I found the bug: For example: @Mapper(componentModel = "spring") public interface ExceptionMapper { @Mappings({ ...
Read more >CheckBoxPreference default value not working [36914268]
setDefaultValues() seems to work when setting default vaues to true, but attempting to set a false as a default value doesn't create the...
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

You must pass a value not an object.
OR
How to achieve this default value behavior for class component?