react-native-mask-input icon indicating copy to clipboard operation
react-native-mask-input copied to clipboard

Mask dd/MM/yyyy

Open ErionTp opened this issue 2 years ago • 4 comments

I have a mask input like this:

<MaskInput
    style={{ fontSize: 15 }}
    maskAutoComplete
    value={date}
    onChangeText={(masked, unmasked) => {
        setMaskedDate(masked)
    }}
    mask={Masks.DATE_MMDDYYYY}
    keyboardType={'numeric'} />

How can i format the mask as dd/MM/yyyy instead of __ /__ /____,

ErionTp avatar Feb 14 '23 11:02 ErionTp

I didn't understand your question

CaioQuirinoMedeiros avatar Feb 14 '23 19:02 CaioQuirinoMedeiros

The placeholder of the MaskInput by default is '__ / __ / ____'. How to make this placeholder show 'dd/MM/yyyy'

ErionTp avatar Feb 21 '23 10:02 ErionTp

@ErionTp you should use the placeholder prop

CaioQuirinoMedeiros avatar Feb 21 '23 11:02 CaioQuirinoMedeiros

@ErionTp just simple set the placeholder props to whatever you want. ie

<MaskInput
 ...otherProps
  mask={Masks.DATE_MMDDYYYY}
  placeholder="dd/MM/yyyy"
/>

anhtuank7c avatar Apr 29 '23 03:04 anhtuank7c