Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
renderUploadProgress() {
const { uploading, progress } = this.state;
if (!uploading) return null;
const { loaded, total } = progress;
// Convert values to human readable values
const prettyLoaded = prettyBytes(loaded);
const prettyTotal = prettyBytes(total);
// Text stuff
const progressText = `(${prettyLoaded}/${prettyTotal})`;
const percentage = total > 0 ? Math.round((loaded / total) * 100) : null;
// Show progress display as: 10% (10kB/100kB)
const percentageText = isNil(percentage) ? '' : `- ${percentage}% ${progressText}`;
return (
);
}
renderUploadProgress() {
const { uploading, progress } = this.state;
if (!uploading) return null;
const { loaded, total } = progress;
// Convert values to human readable values
const prettyLoaded = prettyBytes(loaded);
const prettyTotal = prettyBytes(total);
// Text stuff
const progressText = `(${prettyLoaded}/${prettyTotal})`;
const percentage = total > 0 ? Math.round((loaded / total) * 100) : null;
// Show progress display as: 10% (10kB/100kB)
const percentageText = isNil(percentage) ? '' : `- ${percentage}% ${progressText}`;
return (
);
if (isEmpty(uploads)) return null;
const size = this.getUploadsSize();
return (
);
}
animationType="slide"
visible={visible}
transparent={false}
onRequestClose={this.handleCancelPress}
>
{!isNil(maxUploadSize) && currentImagesSize > 0 &&
}
);
}
}
renderItem = ({ item, index }) => {
const { disableRemoveButton } = this.props;
const ratio = (item.height || 1) / (item.width || 2);
const width = Dimensions.get('window').width;
const height = Math.min(500, width * ratio);
const uri = item.uri || (item.content && item.content.original);
const buttonWidth = disableRemoveButton ? '50%' : '32%';
return (
renderActionBarModal() {
const { busy } = this.state;
if (busy) return null;
const actions = this.canSetActions();
const data = [
{
image: photo,
color: colors.red,
title: `Attach Photos (Max ${prettyBytes(MAX_UPLOAD_SIZE_LIMIT)} or ${MAX_UPLOAD_COUNT} Images)`,
onPress: () => this.handlePressUpload(),
visible: actions.canSetUploads,
},
{
image: giphy,
color: '#8ABE53',
title: 'Search & Share GIF',
onPress: () => this.handleGiphyPickerModal(true),
visible: true,
},
{
image: tag,
color: colors.blue,
title: 'Tag Anime or Manga',
onPress: () => this.handleMediaPickerModal(true),
visible: actions.canSetMedia,