question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Showing the DatePicker doesn't show the picker, just the selected date...

See original GitHub issue

Really confused by this.

image

This is what i see when i show the datepicker. Then i have to click it again to pull up the ‘date’ mode. Then selecting a date doesn’t close the picker.

                <View style={styles.content}>
                    <Text style={styles.contentHeadText}>Date</Text>
                    <TouchableOpacity style={[]} onPress={() => setShowDatePicker(true)} accessibilityRole='button'>
                        <Text>{moment(selectedDate).format('MMM DD')}</Text>
                    </TouchableOpacity>
                    {selectedDate && showDatePicker && (
                        <DateTimePicker
                            style={styles.dropdownContainer}
                            mode={'date'}
                            display='default'
                            minimumDate={now}
                            value={selectedDate}
                            onChange={handleDateChange}
                            textColor={'#000000'}
                        />
                    )}
                </View>

My change handler:

    const handleDateChange = (event, date) => {
        setSelectedDate(date)
        setShowDatePicker(Platform.OS === 'ios')
    }

All I want to do is select a date and have it close with my state updated…

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:9
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
ksamdbcommented, Mar 30, 2021

I changed a display mode to ‘spinner’ to solve this issue.

4reactions
HJafferycommented, Mar 26, 2021

Really confused by this.

image

This is what i see when i show the datepicker. Then i have to click it again to pull up the ‘date’ mode. Then selecting a date doesn’t close the picker.

                <View style={styles.content}>
                    <Text style={styles.contentHeadText}>Date</Text>
                    <TouchableOpacity style={[]} onPress={() => setShowDatePicker(true)} accessibilityRole='button'>
                        <Text>{moment(selectedDate).format('MMM DD')}</Text>
                    </TouchableOpacity>
                    {selectedDate && showDatePicker && (
                        <DateTimePicker
                            style={styles.dropdownContainer}
                            mode={'date'}
                            display='default'
                            minimumDate={now}
                            value={selectedDate}
                            onChange={handleDateChange}
                            textColor={'#000000'}
                        />
                    )}
                </View>

My change handler:

    const handleDateChange = (event, date) => {
        setSelectedDate(date)
        setShowDatePicker(Platform.OS === 'ios')
    }

All I want to do is select a date and have it close with my state updated…

Did you find any solution. I am also stuck on the same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap Datepicker not displaying selected date as ...
When I select start date I update selected value into end date, but when I click on end date datepicker opens up but...
Read more >
DatePicker is not showing the date after selection
Hello James, The DatePicker widget can only be initialized from an INPUT element. I will suggest you check the DatePicker Getting Started help ......
Read more >
DatePicker Doesn't Set Selected Value
The start Date works fine. I select a date from the picker and the value is populated into the StartDate text value and...
Read more >
Date Range Picker — JavaScript Date & Time Picker Library
A JavaScript component for choosing date ranges, dates and times. ... Originally created for reports at Improvely, the Date Range Picker can be...
Read more >
Date picker - Windows apps
By default, the date picker shows the day, month, and year. If your scenario for the date picker doesn't require all the fields, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found