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.

How to open date picker manually

See original GitHub issue

Issue

Hi, I am unable to open date picker manually. Please provide solution for this problem. I am sharing code snippet below.

Code

openDatePicker(date, mode, format, index) {
   this.setState({ datePickerDate: date, datePickerMode: mode, datePickerFormat: format });
   DatePicker.onPressDate;
}

and I am calling this method (openDatePicker) on row click.

Environment

  1. react-native -v: 0.47.1
  2. node -v:6.2.1
  3. npm -v:4.2.0
  4. target platform: Android
  5. operating system: windows 10 64 bit

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:8

github_iconTop GitHub Comments

27reactions
EyalSicommented, Feb 4, 2018

use: <DatePicker showIcon={false} hideText={true} ref={(ref)=>this.datePickerRef=ref} … />

and from your element: onPress={() => this.datePickerRef.onPressDate()

8reactions
evrimfeyyazcommented, Jul 24, 2019

Here is how you can open it manually with hooks:

import { useRef } from 'react';

// ...

const datePickerRef = useRef(null);

// ...

<SomeComponent onPress={() => datePickerRef.current.onPressDate()} />

// ...

<DatePicker showIcon={false} hideText={true} ref={datePickerRef} />
Read more comments on GitHub >

github_iconTop Results From Across the Web

JQuery UI DatePicker - How to manually open a datepicker
To show the datepicker associated to the input with id 'your_elem', you would use something like this: jQuery('#your_elem').datepicker("show");.
Read more >
Opening DatePicker manually · Issue #685 · Hacker0x01/react ...
This works by calling renderEditingComponent() when clicking a date value on a table column, which makes an input appears on top of it....
Read more >
Datepicker Widget - jQuery UI API Documentation
CTRL + HOME : Open the datepicker if closed. CTRL / COMMAND + HOME : Move to the current month. CTRL / COMMAND...
Read more >
How to Add a Date Picker in HTML? - Scaler Topics
Here we can see the input has the default date, which is set in the value attribute. Clicking on the calendar icon will...
Read more >
Add Datepicker to Input Field using jQuery UI - CodexWorld
The Datepicker helps to input a date by selecting it from the calendar without manually enter in the input field. When you want...
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