add currency selector on publish page

This commit is contained in:
Akinwale Ariwodola 2019-09-10 13:23:34 +01:00
parent c88961002f
commit c7ce7ea284
2 changed files with 21 additions and 2 deletions

View file

@ -120,6 +120,7 @@ class PublishPage extends React.PureComponent {
otherLicenseDescription: '', otherLicenseDescription: '',
name: null, name: null,
price: 0, price: 0,
currency: 'LBC',
uri: null, uri: null,
tags: [], tags: [],
selectedChannel: null, selectedChannel: null,
@ -236,6 +237,7 @@ class PublishPage extends React.PureComponent {
licenseUrl, licenseUrl,
otherLicenseDescription, otherLicenseDescription,
name, name,
currency: fee && fee.currency ? fee.currency : 'LBC',
price: fee && fee.amount ? fee.amount : 0, price: fee && fee.amount ? fee.amount : 0,
priceSet: fee && fee.amount > 0, priceSet: fee && fee.amount > 0,
tags: tags && tags.length > 0 ? tags : [], tags: tags && tags.length > 0 ? tags : [],
@ -291,6 +293,7 @@ class PublishPage extends React.PureComponent {
bid, bid,
channelName, channelName,
currentMedia, currentMedia,
currency,
description, description,
language, language,
license, license,
@ -334,7 +337,7 @@ class PublishPage extends React.PureComponent {
otherLicenseDescription, otherLicenseDescription,
name: name || undefined, name: name || undefined,
contentIsFree: !priceSet, contentIsFree: !priceSet,
fee: { currency: 'LBC', amount: price }, fee: { currency, amount: price },
uri: uri || undefined, uri: uri || undefined,
channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName, channel: CLAIM_VALUES.CHANNEL_ANONYMOUS === channelName ? null : channelName,
isStillEditing: false, isStillEditing: false,
@ -653,6 +656,10 @@ class PublishPage extends React.PureComponent {
} }
}; };
handleCurrencyValueChange = currency => {
this.setState({ currency });
};
handleDescriptionChange = description => { handleDescriptionChange = description => {
this.setState({ description }); this.setState({ description });
}; };
@ -886,7 +893,16 @@ class PublishPage extends React.PureComponent {
value={String(this.state.price)} value={String(this.state.price)}
onChangeText={this.handlePriceChange} 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> </View>

View file

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