fixes per review

This commit is contained in:
Akinwale Ariwodola 2019-10-15 17:55:49 +01:00
parent 682443d9ae
commit a4fad20ff1
3 changed files with 20 additions and 10 deletions

View file

@ -138,6 +138,8 @@ const Constants = {
MORE_PLACEHOLDER: '_more',
TRUE_STRING: 'true',
MINIMUM_TRANSACTION_BALANCE: 0.1,
};
export default Constants;

View file

@ -32,6 +32,8 @@ import channelIconStyle from 'styles/channelIcon';
import seedrandom from 'seedrandom';
export default class ChannelCreator extends React.PureComponent {
scrollView = null;
state = {
autoStyle: null,
canSave: true,
@ -389,11 +391,13 @@ export default class ChannelCreator extends React.PureComponent {
website,
} = this.state;
if (balance < 0.1) {
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
notify({
message:
"You don't have enough credits to create a channel. Press the blue bar to earn some credits from rewards!",
message: 'Creating a channel requires credits. Press the blue bar to get some for free.',
});
if (this.scrollView) {
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
}
return;
}
@ -846,7 +850,7 @@ export default class ChannelCreator extends React.PureComponent {
)}
{currentPhase === Constants.PHASE_CREATE && (
<ScrollView style={channelCreatorStyle.createChannelContainer}>
<ScrollView ref={ref => (this.scrollView = ref)} style={channelCreatorStyle.createChannelContainer}>
<View style={channelCreatorStyle.imageSelectors}>
<TouchableOpacity style={channelCreatorStyle.coverImageTouchArea} onPress={this.onCoverImagePress}>
<Image
@ -891,7 +895,7 @@ export default class ChannelCreator extends React.PureComponent {
</TouchableOpacity>
</View>
</View>
{balance < 0.1 && <ChannelRewardsDriver navigation={navigation} />}
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <ChannelRewardsDriver navigation={navigation} />}
<View style={channelCreatorStyle.card}>
<View style={channelCreatorStyle.textInputLayout}>

View file

@ -76,6 +76,8 @@ const languages = {
class PublishPage extends React.PureComponent {
camera = null;
scrollView = null;
state = {
canPublish: true,
canUseCamera: false,
@ -339,11 +341,13 @@ class PublishPage extends React.PureComponent {
uri,
} = this.state;
if (balance < 0.1) {
if (balance < Constants.MINIMUM_TRANSACTION_BALANCE) {
notify({
message:
"You don't have enough credits to publish this content. Press the blue bar at the top to earn some credits from rewards!",
message: 'Publishing content requires credits. Press the blue bar to get some for free.',
});
if (this.scrollView) {
this.scrollView.scrollTo({ x: 0, y: 0, animated: true });
}
return;
}
@ -968,7 +972,7 @@ class PublishPage extends React.PureComponent {
this.updateThumbnailUriForMedia(currentMedia);
}
content = (
<ScrollView style={publishStyle.publishDetails}>
<ScrollView ref={ref => (this.scrollView = ref)} style={publishStyle.publishDetails}>
<TouchableOpacity style={publishStyle.mainThumbnailContainer} onPress={this.handleThumbnailPressed}>
<FastImage
style={publishStyle.mainThumbnail}
@ -987,7 +991,7 @@ class PublishPage extends React.PureComponent {
</View>
)}
</TouchableOpacity>
{balance < 0.1 && <PublishRewardsDriver navigation={navigation} />}
{balance < Constants.MINIMUM_TRANSACTION_BALANCE && <PublishRewardsDriver navigation={navigation} />}
<View style={publishStyle.card}>
<View style={publishStyle.textInputLayout}>