开发者

how to make date picker in the form of input filed in react native

开发者 https://www.devze.com 2022-12-07 20:30 出处:网络
i was able to opendate picker with buttoni am trying to open it with text input here is i how i open my calender

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 somethi开发者_开发技巧ng like this that will open the calender when clicked on textinput fild

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


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}
    />


You can wrap your code like this,

<TouchableOpacity 
    activeOpcaity={1}
    onPress={() => setShowCalender(true)}>
<TextInput  value={calenderDate} />
</TouchableOpacity>
0

精彩评论

暂无评论...
验证码 换一张
取 消