skip to Main Content

i was able to open date picker with button i am trying to open it with text input

here is i how i open my calender

<Button onPress={displayDatepicker} title="Show date picker!" />

i am looking for something like this that will open the calender when clicked on textinput fild

  <TextInput
          style={styles.forminput}
          label=" Date of Birth"
          value=""
          onclick={displayDatepicker}
        />

2

Answers


  1. Try this maybe it will work.

     <TextInput
          style={styles.forminput}
          label=" Date of Birth"
          value=""
          onPressIn={displayDatepicker}
        />
    

    or this will also work,

       <TextInput
          style={styles.forminput}
          label=" Date of Birth"
          value=""
          onFocus={displayDatepicker}
        />
    
    Login or Signup to reply.
  2. You can wrap your code like this,

    <TouchableOpacity 
        activeOpcaity={1}
        onPress={() => setShowCalender(true)}>
    <TextInput  value={calenderDate} />
    </TouchableOpacity>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search