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",
|
"base-64": "^0.1.0",
|
||||||
"@expo/vector-icons": "^8.1.0",
|
"@expo/vector-icons": "^8.1.0",
|
||||||
"gfycat-style-urls": "^1.0.3",
|
"gfycat-style-urls": "^1.0.3",
|
||||||
"lbry-redux": "lbryio/lbry-redux#4f812db1c7cdb4c08c5426d4d3f83023de5d655f",
|
"lbry-redux": "lbryio/lbry-redux#73f10d488d5fd5df7aa806b60c8df5c948ca3c9a",
|
||||||
"lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d",
|
"lbryinc": "lbryio/lbryinc#17868d948a160af27a375956226f8dd23fa2c37d",
|
||||||
"lodash": ">=4.17.11",
|
"lodash": ">=4.17.11",
|
||||||
"merge": ">=1.2.1",
|
"merge": ">=1.2.1",
|
||||||
|
|
|
@ -70,6 +70,7 @@ class FilePage extends React.PureComponent {
|
||||||
mediaLoaded: false,
|
mediaLoaded: false,
|
||||||
pageSuspended: false,
|
pageSuspended: false,
|
||||||
relatedContentY: 0,
|
relatedContentY: 0,
|
||||||
|
sendTipStarted: false,
|
||||||
showDescription: false,
|
showDescription: false,
|
||||||
showImageViewer: false,
|
showImageViewer: false,
|
||||||
showWebView: false,
|
showWebView: false,
|
||||||
|
@ -498,7 +499,7 @@ class FilePage extends React.PureComponent {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const suffix = 'credit' + (tipAmount === 1 ? '' : 's');
|
const suffix = 'credit' + (parseInt(tipAmount, 10) === 1 ? '' : 's');
|
||||||
Alert.alert(
|
Alert.alert(
|
||||||
'Send tip',
|
'Send tip',
|
||||||
`Are you sure you want to tip ${tipAmount} ${suffix}?`,
|
`Are you sure you want to tip ${tipAmount} ${suffix}?`,
|
||||||
|
@ -507,9 +508,11 @@ class FilePage extends React.PureComponent {
|
||||||
{
|
{
|
||||||
text: 'Yes',
|
text: 'Yes',
|
||||||
onPress: () => {
|
onPress: () => {
|
||||||
|
this.setState({ sendTipStarted: true }, () =>
|
||||||
sendTip(tipAmount, claim.claim_id, false, () => {
|
sendTip(tipAmount, claim.claim_id, false, () => {
|
||||||
this.setState({ tipAmount: 0, showTipView: 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.row}>
|
||||||
<View style={filePageStyle.amountRow}>
|
<View style={filePageStyle.amountRow}>
|
||||||
<TextInput
|
<TextInput
|
||||||
|
editable={!this.state.sendTipStarted}
|
||||||
ref={ref => (this.tipAmountInput = ref)}
|
ref={ref => (this.tipAmountInput = ref)}
|
||||||
onChangeText={value => this.setState({ tipAmount: value })}
|
onChangeText={value => this.setState({ tipAmount: value })}
|
||||||
underlineColorAndroid={Colors.NextLbryGreen}
|
underlineColorAndroid={Colors.NextLbryGreen}
|
||||||
keyboardType={'numeric'}
|
keyboardType={'numeric'}
|
||||||
placeholder={'0'}
|
placeholder={'0'}
|
||||||
value={this.state.tipAmount}
|
value={this.state.tipAmount}
|
||||||
|
selectTextOnFocus
|
||||||
style={[filePageStyle.input, filePageStyle.tipAmountInput]}
|
style={[filePageStyle.input, filePageStyle.tipAmountInput]}
|
||||||
/>
|
/>
|
||||||
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
|
<Text style={[filePageStyle.text, filePageStyle.currency]}>LBC</Text>
|
||||||
</View>
|
</View>
|
||||||
|
{this.state.sendTipStarted && <ActivityIndicator size={'small'} color={Colors.NextLbryGreen} />}
|
||||||
<Link
|
<Link
|
||||||
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
|
style={[filePageStyle.link, filePageStyle.cancelTipLink]}
|
||||||
text={'Cancel'}
|
text={'Cancel'}
|
||||||
|
@ -955,7 +961,7 @@ class FilePage extends React.PureComponent {
|
||||||
<Button
|
<Button
|
||||||
text={'Send a tip'}
|
text={'Send a tip'}
|
||||||
style={[filePageStyle.button, filePageStyle.sendButton]}
|
style={[filePageStyle.button, filePageStyle.sendButton]}
|
||||||
disabled={!canSendTip}
|
disabled={!canSendTip || this.state.sendTipStarted}
|
||||||
onPress={this.handleSendTip}
|
onPress={this.handleSendTip}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
Loading…
Reference in a new issue