Merge pull request from lbryio/publish-currency

add currency selector on publish page
This commit is contained in:
Akinwale Ariwodola 2019-09-11 09:07:34 +01:00 committed by GitHub
commit 6ce143b145
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 2 deletions
src
page/publish
styles

View file

@ -121,6 +121,7 @@ class PublishPage extends React.PureComponent {
otherLicenseDescription: '',
name: null,
price: 0,
currency: 'LBC',
uri: null,
tags: [],
selectedChannel: null,
@ -241,6 +242,7 @@ class PublishPage extends React.PureComponent {
licenseUrl,
otherLicenseDescription,
name,
currency: fee && fee.currency ? fee.currency : 'LBC',
price: fee && fee.amount ? fee.amount : 0,
priceSet: fee && fee.amount > 0,
tags: tags && tags.length > 0 ? tags : [],
@ -296,6 +298,7 @@ class PublishPage extends React.PureComponent {
bid,
channelName,
currentMedia,
currency,
description,
language,
license,
@ -339,7 +342,7 @@ class PublishPage extends React.PureComponent {
otherLicenseDescription,
name: name || undefined,
contentIsFree: !priceSet,
fee: { currency: 'LBC', amount: price },
fee: { currency, amount: price },
uri: uri || undefined,
channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName,
isStillEditing: false,
@ -689,6 +692,10 @@ class PublishPage extends React.PureComponent {
}
};
handleCurrencyValueChange = currency => {
this.setState({ currency });
};
handleDescriptionChange = description => {
this.setState({ description });
};
@ -920,7 +927,16 @@ class PublishPage extends React.PureComponent {
value={String(this.state.price)}
onChangeText={this.handlePriceChange}
/>
<Text style={publishStyle.currency}>LBC</Text>
<Picker
style={publishStyle.currencyPicker}
enabled={this.state.canPublish && !this.state.publishStarted}
selectedValue={this.state.currency}
itemStyle={publishStyle.pickerItem}
onValueChange={this.handleCurrencyValueChange}
>
<Picker.Item label={'LBC'} value={'LBC'} />
<Picker.Item label={'USD'} value={'USD'} />
</Picker>
</View>
)}
</View>

View file

@ -362,6 +362,9 @@ const publishStyle = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},
currencyPicker: {
width: 100,
},
fullCentered: {
position: 'absolute',
left: 0,