Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions src/pages/iou/ReceiptSelector/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {View, Text, PixelRatio} from 'react-native';
import React, {useContext, useState} from 'react';
import {View, Text, PanResponder, PixelRatio} from 'react-native';
import React, {useContext, useRef, useState} from 'react';
import lodashGet from 'lodash/get';
import _ from 'underscore';
import PropTypes from 'prop-types';
Expand Down Expand Up @@ -130,6 +130,13 @@ function ReceiptSelector(props) {
IOU.navigateToNextPage(iou, iouType, reportID, report, props.route.path);
};

const panResponder = useRef(
PanResponder.create({
onMoveShouldSetPanResponder: () => true,
onPanResponderTerminationRequest: () => false,
}),
).current;

return (
<View style={[styles.uploadReceiptView(isSmallScreenWidth)]}>
{!isDraggingOver ? (
Expand All @@ -144,15 +151,21 @@ function ReceiptSelector(props) {
height={CONST.RECEIPT.ICON_SIZE}
/>
</View>
<Text style={[styles.textReceiptUpload]}>{translate('receipt.upload')}</Text>
<Text style={[styles.subTextReceiptUpload]}>
{isSmallScreenWidth ? translate('receipt.chooseReceipt') : translate('receipt.dragReceiptBeforeEmail')}
<CopyTextToClipboard
text={CONST.EMAIL.RECEIPTS}
textStyles={[styles.textBlue]}
/>
{isSmallScreenWidth ? null : translate('receipt.dragReceiptAfterEmail')}
</Text>
<View
style={styles.receiptViewTextContainer}
// eslint-disable-next-line react/jsx-props-no-spreading
{...panResponder.panHandlers}
>
<Text style={[styles.textReceiptUpload]}>{translate('receipt.upload')}</Text>
<Text style={[styles.subTextReceiptUpload]}>
{isSmallScreenWidth ? translate('receipt.chooseReceipt') : translate('receipt.dragReceiptBeforeEmail')}
<CopyTextToClipboard
text={CONST.EMAIL.RECEIPTS}
textStyles={[styles.textBlue]}
/>
{isSmallScreenWidth ? null : translate('receipt.dragReceiptAfterEmail')}
</Text>
</View>
<AttachmentPicker>
{({openPicker}) => (
<PressableWithFeedback
Expand Down
7 changes: 6 additions & 1 deletion src/styles/styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -767,11 +767,16 @@ const styles = (theme) => ({
marginRight: 20,
justifyContent: 'center',
alignItems: 'center',
padding: 40,
paddingVertical: 40,
gap: 4,
flex: 1,
}),

receiptViewTextContainer: {
paddingHorizontal: 40,
...sizing.w100,
},

cameraView: {
flex: 1,
overflow: 'hidden',
Expand Down