From 7e8934305f5e7d1943900c5d7f3340f696745dd1 Mon Sep 17 00:00:00 2001 From: ludorum Date: Tue, 20 Jun 2017 11:29:01 +0900 Subject: [PATCH] fix issuse #20 and one more things. (#24) * memo trim is processed when preview popup. * alphabet and spaces are removed from send amount field. --- app/components/Send.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/components/Send.js b/app/components/Send.js index 312818f..270e86b 100644 --- a/app/components/Send.js +++ b/app/components/Send.js @@ -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) => { @@ -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(); }