Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

formatting is not working as specified in libphonenumber #172

Closed
msita143 opened this issue Aug 2, 2018 · 13 comments

Comments

@msita143
Copy link

@msita143 msita143 commented Aug 2, 2018

Hi,
I am using react-phone-number-input/basic-input as below :
``
Using app created via create-react-app with no webpack.
Now if I enter 20 the number formatted as (20 ) and caret goes after parenthesis. But as per below link
https://libphonenumber.appspot.com/phonenumberparser?number=2071234567&country=US
the number should only if I type (207) 123-45.
Is there a way I can get the number formatted only after I type more then three char atleast.

Also when I try to use SmartInput as below:

`import PhoneInput from "react-phone-number-input/basic-input";

import SmartInput from 'react-phone-number-input/smart-input'

    <PhoneInput

      inputComponent={SmartInput}

      className="react-phone-number-input__input"
      country={region}
      smartCaret={ true }
      value={this.state.mobileNumber}
      placeholder={this.props.intl.formatMessage(messages.phonePlaceholder)}
      onChange={this.onUpdatePhone}
      onBlur={event => this.onBlurValidate(event)}
    />

`

I get warning and it doesn't work:

Warning: React does not recognize the inputComponent prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase inputcomponent instead. If you accidentally passed it from a parent component, remove it from the DOM element.
in input (created by InputBasic)
in InputBasic (created by InputBasicDefaultMetadata)
in InputBasicDefaultMetadata (at PhoneNumber.js:54)
in div (created by styled.div)
in styled.div (at PhoneNumber.js:53)
in PhoneNumber (created by InjectIntl(PhoneNumber))

Thanks
Manish

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

Here is how it looksl ike after I enter only two char
image
which we don't want.

@catamphetamine

This comment has been minimized.

Copy link
Owner

@catamphetamine catamphetamine commented Aug 2, 2018

Format the code appropriately.

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

What does it mean?
I guess the issue is with this lib as even demo behaves the same.

@catamphetamine

This comment has been minimized.

Copy link
Owner

@catamphetamine catamphetamine commented Aug 2, 2018

What does it mean?

Your original message is not formatted properly.

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

Check it now.
Though as I am saying it is not the code it is the way you guys use "As You Type" formatter.
Just asking if you have any work around for my request
Thanks
Manish

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

@catamphetamine : Any help on my above comment?
Thanks

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

See in demo parenthesis appears as I type two digits:
image

Please help me with this as we don't want to format until user enter 6 digits and if possible to add smart caret

@catamphetamine

This comment has been minimized.

Copy link
Owner

@catamphetamine catamphetamine commented Aug 2, 2018

Is there a way I can get the number formatted only after I type more then three char atleast.

I see what you mean.
Indeed, it looks confusing with smartCaret={false} option.
It looked right when smartCaret={true} was present in previous releases.
I guess it should be changed somehow.
Not simply ignoring until 3 digits but something more intelligent.
Maybe not inserting the closing parenthesis or something.
It's not a fast decision.

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

@catamphetamine : Now I am a bit confused.
Is there a way I can change the behaviour of parenthesis (should not appear after typing two digits) as I need submit my code or it will take time.

Let forget about smart caret for now.

@catamphetamine

This comment has been minimized.

Copy link
Owner

@catamphetamine catamphetamine commented Aug 2, 2018

It will take time.

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

oh ok. How long will it take.
else I need to look into use other lib for fix yrs locally.

Thanks

@catamphetamine

This comment has been minimized.

Copy link
Owner

@catamphetamine catamphetamine commented Aug 2, 2018

Look at other lib

@msita143

This comment has been minimized.

Copy link
Author

@msita143 msita143 commented Aug 2, 2018

gr8 response.
thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.