Merge pull request #220 from lbryio/play-icon
Add play icon to the Play button for media
This commit is contained in:
commit
2672144dbe
3 changed files with 17 additions and 14 deletions
|
@ -1,5 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
import { NativeModules, Text, View, TouchableOpacity } from 'react-native';
|
||||||
|
import Button from '../button';
|
||||||
import fileDownloadButtonStyle from '../../styles/fileDownloadButton';
|
import fileDownloadButtonStyle from '../../styles/fileDownloadButton';
|
||||||
|
|
||||||
class FileDownloadButton extends React.PureComponent {
|
class FileDownloadButton extends React.PureComponent {
|
||||||
|
@ -64,7 +65,9 @@ class FileDownloadButton extends React.PureComponent {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={[style, fileDownloadButtonStyle.container]} onPress={() => {
|
<Button icon={isPlayable ? 'play' : null}
|
||||||
|
text={isPlayable ? 'Play' : 'Download'}
|
||||||
|
style={[style, fileDownloadButtonStyle.container]} onPress={() => {
|
||||||
if (NativeModules.Mixpanel) {
|
if (NativeModules.Mixpanel) {
|
||||||
NativeModules.Mixpanel.track('Purchase Uri', { Uri: uri });
|
NativeModules.Mixpanel.track('Purchase Uri', { Uri: uri });
|
||||||
}
|
}
|
||||||
|
@ -72,9 +75,7 @@ class FileDownloadButton extends React.PureComponent {
|
||||||
if (isPlayable && onPlay) {
|
if (isPlayable && onPlay) {
|
||||||
this.props.onPlay();
|
this.props.onPlay();
|
||||||
}
|
}
|
||||||
}}>
|
}} />
|
||||||
<Text style={fileDownloadButtonStyle.text}>{isPlayable ? 'Play' : 'Download'}</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
);
|
);
|
||||||
} else if (fileInfo && fileInfo.download_path) {
|
} else if (fileInfo && fileInfo.download_path) {
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -5,13 +5,14 @@ const buttonStyle = StyleSheet.create({
|
||||||
borderRadius: 24,
|
borderRadius: 24,
|
||||||
padding: 8,
|
padding: 8,
|
||||||
paddingLeft: 12,
|
paddingLeft: 12,
|
||||||
paddingRight: 12
|
paddingRight: 12,
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'center'
|
||||||
},
|
},
|
||||||
disabled: {
|
disabled: {
|
||||||
backgroundColor: '#999999'
|
backgroundColor: '#999999'
|
||||||
},
|
},
|
||||||
row: {
|
row: {
|
||||||
alignSelf: 'flex-start',
|
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
},
|
},
|
||||||
icon: {
|
icon: {
|
||||||
|
|
|
@ -20,7 +20,8 @@ const walletStyle = StyleSheet.create({
|
||||||
width: '85%'
|
width: '85%'
|
||||||
},
|
},
|
||||||
button: {
|
button: {
|
||||||
backgroundColor: Colors.LbryGreen
|
backgroundColor: Colors.LbryGreen,
|
||||||
|
alignSelf: 'flex-start'
|
||||||
},
|
},
|
||||||
historyList: {
|
historyList: {
|
||||||
backgroundColor: '#ffffff'
|
backgroundColor: '#ffffff'
|
||||||
|
|
Loading…
Reference in a new issue