Skip to content

Commit

Permalink
Show video icon marker for video files.
Browse files Browse the repository at this point in the history
Otherwise, you can't tell which thumbnail is an image and which is a video, a very important distinction in most cases.

Addresses jeanpan#19.

Also add `accessibilityLabel` for "videoMarker" for ease of targetting in automated testing.
  • Loading branch information
joshuapinter committed Dec 2, 2020
1 parent 69abd4a commit 6b58766
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ImageItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import PropTypes from 'prop-types';

const checkIcon = require('./circle-check.png');
const videoIcon = require('./videocam.png');

const styles = StyleSheet.create({
marker: {
Expand All @@ -16,6 +17,14 @@ const styles = StyleSheet.create({
right: 5,
backgroundColor: 'transparent',
},
videoMarker: {
position: 'absolute',
bottom: 5,
right: 5,
backgroundColor: 'transparent',
width: 50,
height: 30
},
});

class ImageItem extends Component {
Expand All @@ -38,6 +47,10 @@ class ImageItem extends Component {
item, selected, selectedMarker, imageMargin,
} = this.props;

let videoMarker;
if ( item.node.type.startsWith( "video" ) )
videoMarker = <Image style={styles.videoMarker} source={videoIcon} accessibilityLabel="videoMarker" />;

const marker = selectedMarker || (<Image
style={[styles.marker, { width: 25, height: 25 }]}
source={checkIcon}
Expand All @@ -54,6 +67,7 @@ class ImageItem extends Component {
source={{ uri: image.uri }}
style={{ height: this.imageSize, width: this.imageSize }}
/>
{videoMarker}
{(selected) ? marker : null}
</TouchableOpacity>
);
Expand Down
Binary file added videocam.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 6b58766

Please sign in to comment.