Skip to content

Commit

Permalink
feat: PhoneNumberInput trims special char
Browse files Browse the repository at this point in the history
  • Loading branch information
nnnnat committed Jul 17, 2018
1 parent 5b34504 commit 37662ec
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
24 changes: 12 additions & 12 deletions package/src/components/PhoneNumberInput/v1/PhoneNumberInput.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
import React, { Component } from "react";
import PropTypes from "prop-types";
import styled from "styled-components";
import { applyTheme } from "../../../utils";

const StyledDiv = styled.div`
color: #333333;
`;
import TextInput from "../../TextInput/v1";

class PhoneNumberInput extends Component {
static propTypes = {
static propTypes = {};

};
static defaultProps = {};

static defaultProps = {
state = {
value: this.props.value || ""
};

handdleChanging = (value) => {
if (!value) return;
const trimedValue = value.replace(/\D/g, "");
this.setState({ value: trimedValue });
};

render() {
return (
<StyledDiv>TEST</StyledDiv>
);
const { value } = this.state;
return <TextInput onChanging={this.handdleChanging} value={value} />;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### PhoneNumberInput

Document component here. See https://react-styleguidist.js.org/docs/documenting.html
#### Basic Usage
```jsx
<PhoneNumberInput />
```

0 comments on commit 37662ec

Please sign in to comment.