send tip fix and tweaks
This commit is contained in:
parent
384550cc63
commit
10e92b2834
2 changed files with 12 additions and 6 deletions
|
@ -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",
|
||||
|
|
|
@ -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 {
|
|||
<View style={filePageStyle.row}>
|
||||
<View style={filePageStyle.amountRow}>
|
||||
<TextInput
|
||||
editable={!this.state.sendTipStarted}
|
||||
ref={ref => (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]}
|
||||
/>
|
||||
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
|
||||
</View>
|
||||
{this.state.sendTipStarted && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||
<Link
|
||||
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
|
||||
text={'Cancel'}
|
||||
|
@ -955,7 +961,7 @@ class FilePage extends React.PureComponent {
|
|||
<Button
|
||||
text={'Send a tip'}
|
||||
style={[filePageStyle.button, filePageStyle.sendButton]}
|
||||
disabled={!canSendTip}
|
||||
disabled={!canSendTip || this.state.sendTipStarted}
|
||||
onPress={this.handleSendTip}
|
||||
/>
|
||||
</View>
|
||||
|
|
Loading…
Reference in a new issue