React Input Mask how to put the ninth digit?

2

I downloaded the package npm i react-text-mask --save I made the import in my Contact file but by default it goes out like this (55) 5555-5555 I'm having trouble putting this pattern 5555-5555

Could anyone give me a hint how to do this?

My code looks like this:

<div class="row">
  <div class="input-field col s12">
    <MaskedInput
      mask={['(', /[1-9]/, /\d/, ')', ' ', /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]}
      className="form-control"
      placeholder="Enter a phone number"
      guide={false}
      id="my-input-id"
      onBlur={() => {}}
      onChange={() => {}}
      />
 </div>

    
asked by anonymous 18.05.2018 / 21:51

1 answer

3

Include a new digit /\d/ and a space in the default:

                              nono dígito  espaço
                                       ↓    ↓
mask={['(', /[1-9]/, /\d/, ')', ' ', /\d/, ' ', /\d/, /\d/, /\d/, /\d/, '-', /\d/, /\d/, /\d/, /\d/]}
    
18.05.2018 / 23:48