Skip to content

Commit

Permalink
fix issuse #20 and one more things. (#24)
Browse files Browse the repository at this point in the history
* memo trim is processed when preview popup.

* alphabet and spaces are removed from send amount field.
  • Loading branch information
ludorum authored and aaroncox committed Jun 20, 2017
1 parent b03e527 commit 7e89343
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/components/Send.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,13 @@ export default class Send extends Component {
}

handleMemoChange = (e: SyntheticEvent, { value }: { value: string }) => {
const cleaned = value.trim();
const cleaned = value.replace(/\s+/gim, ' ');
this.setState({ memo: cleaned });
}

handleAmountChange = (e: SyntheticEvent, { value }: { value: any }) => {
this.setState({ amount: value });
const cleaned = value.replace(/[a-z\s]+/gim, '');
this.setState({ amount: cleaned });
}

setAmountMaximum = (e: SyntheticEvent) => {
Expand All @@ -153,7 +154,11 @@ export default class Send extends Component {

handlePreview = (e: SyntheticEvent) => {
if(this.isFormValid()) {
this.setState({ modalPreview: true });
const cleaned = this.state.memo.trim();
this.setState({
memo: cleaned,
modalPreview: true
});
}
e.preventDefault();
}
Expand Down

0 comments on commit 7e89343

Please sign in to comment.