From 10e92b283486d3ed57f0c99fb3d75b39aa4fd2b7 Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Fri, 23 Aug 2019 09:19:02 +0100 Subject: [PATCH] send tip fix and tweaks --- package.json | 2 +- src/page/file/view.js | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 8a0beb9..ab89e00 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "base-64": "^0.1.0", "@expo/vector-icons": "^8.1.0", "gfycat-style-urls": "^1.0.3", - "lbry-redux": "lbryio/lbry-redux#4f812db1c7cdb4c08c5426d4d3f83023de5d655f", + "lbry-redux": "lbryio/lbry-redux#73f10d488d5fd5df7aa806b60c8df5c948ca3c9a", "lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d", "lodash": ">=4.17.11", "merge": ">=1.2.1", diff --git a/src/page/file/view.js b/src/page/file/view.js index 2484385..99fee98 100644 --- a/src/page/file/view.js +++ b/src/page/file/view.js @@ -70,6 +70,7 @@ class FilePage extends React.PureComponent { mediaLoaded: false, pageSuspended: false, relatedContentY: 0, + sendTipStarted: false, showDescription: false, showImageViewer: false, showWebView: false, @@ -498,7 +499,7 @@ class FilePage extends React.PureComponent { return; } - const suffix = 'credit' + (tipAmount === 1 ? '' : 's'); + const suffix = 'credit' + (parseInt(tipAmount, 10) === 1 ? '' : 's'); Alert.alert( 'Send tip', `Are you sure you want to tip ${tipAmount} ${suffix}?`, @@ -507,9 +508,11 @@ class FilePage extends React.PureComponent { { text: 'Yes', onPress: () => { - sendTip(tipAmount, claim.claim_id, false, () => { - this.setState({ tipAmount: 0, showTipView: false }); - }); + this.setState({ sendTipStarted: true }, () => + sendTip(tipAmount, claim.claim_id, false, () => { + this.setState({ tipAmount: null, showTipView: false, sendTipStarted: false }); + }) + ); }, }, ], @@ -937,16 +940,19 @@ class FilePage extends React.PureComponent { (this.tipAmountInput = ref)} onChangeText={value => this.setState({ tipAmount: value })} underlineColorAndroid={Colors.NextLbryGreen} keyboardType={'numeric'} placeholder={'0'} value={this.state.tipAmount} + selectTextOnFocus style={[filePageStyle.input, filePageStyle.tipAmountInput]} /> LBC + {this.state.sendTipStarted && }