Skip to content

Commit

Permalink
update proptypes
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardoj committed Aug 25, 2023
1 parent fe02d63 commit 28065b4
Show file tree
Hide file tree
Showing 10 changed files with 158 additions and 65 deletions.
19 changes: 19 additions & 0 deletions src/pages/iou/IOUCurrencySelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,24 @@ const greenCheckmark = {src: Expensicons.Checkmark, color: themeColors.success};
* IOU Currency selection for selecting currency
*/
const propTypes = {
/** Route from navigation */
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,

/** Currently selected currency */
currency: PropTypes.string,

/** Route to navigate back after selecting a currency */
backTo: PropTypes.string,
}),
}).isRequired,

// The currency list constant object from Onyx
currencyList: PropTypes.objectOf(
PropTypes.shape({
Expand All @@ -40,6 +58,7 @@ const propTypes = {

/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** Currency of the request */
currency: PropTypes.string,
}),

Expand Down
13 changes: 13 additions & 0 deletions src/pages/iou/MoneyRequestDatePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ const propTypes = {
/** Onyx Props */
/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,

/** Description of the request */
comment: PropTypes.string,
created: PropTypes.string,

/** List of the participants */
participants: PropTypes.arrayOf(optionPropTypes),
receiptPath: PropTypes.string,
}),
Expand All @@ -31,6 +38,12 @@ const propTypes = {
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,

/** Which field we are editing */
field: PropTypes.string,

Expand Down
13 changes: 13 additions & 0 deletions src/pages/iou/MoneyRequestDescriptionPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ const propTypes = {
/** Onyx Props */
/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,

/** Description of the request */
comment: PropTypes.string,

/** List of the participants */
participants: PropTypes.arrayOf(optionPropTypes),
receiptPath: PropTypes.string,
}),
Expand All @@ -32,6 +39,12 @@ const propTypes = {
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,

/** Which field we are editing */
field: PropTypes.string,

Expand Down
13 changes: 13 additions & 0 deletions src/pages/iou/MoneyRequestMerchantPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,18 @@ const propTypes = {
/** Onyx Props */
/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,

/** Description of the request */
comment: PropTypes.string,
created: PropTypes.string,
merchant: PropTypes.string,

/** List of the participants */
participants: PropTypes.arrayOf(optionPropTypes),
receiptPath: PropTypes.string,
}),
Expand All @@ -34,6 +41,12 @@ const propTypes = {
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,

/** Which field we are editing */
field: PropTypes.string,

Expand Down
19 changes: 12 additions & 7 deletions src/pages/iou/MoneyRequestSelectorPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,28 @@ import NewRequestAmountPage from './steps/NewRequestAmountPage';
const propTypes = {
/** React Navigation route */
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,
}),
}),
}).isRequired,

/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,

/** Currency of the request */
currency: PropTypes.string,

/** List of the participants */
participants: PropTypes.arrayOf(participantPropTypes),
}),

Expand All @@ -44,12 +55,6 @@ const propTypes = {
};

const defaultProps = {
route: {
params: {
iouType: '',
reportID: '',
},
},
iou: {
id: '',
amount: 0,
Expand Down
31 changes: 15 additions & 16 deletions src/pages/iou/ReceiptSelector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import PropTypes from 'prop-types';
import {withOnyx} from 'react-native-onyx';
import * as IOU from '../../../libs/actions/IOU';
import reportPropTypes from '../../reportPropTypes';
import participantPropTypes from '../../../components/participantPropTypes';
import CONST from '../../../CONST';
import ReceiptUpload from '../../../../assets/images/receipt-upload.svg';
import PressableWithFeedback from '../../../components/Pressable/PressableWithFeedback';
Expand Down Expand Up @@ -32,27 +33,31 @@ const propTypes = {
/** The report on which the request is initiated on */
report: reportPropTypes,

/** React Navigation route */
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,
}),
}),
}).isRequired,

/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,

/** Currency of the request */
currency: PropTypes.string,
participants: PropTypes.arrayOf(
PropTypes.shape({
accountID: PropTypes.number,
login: PropTypes.string,
isPolicyExpenseChat: PropTypes.bool,
isOwnPolicyExpenseChat: PropTypes.bool,
selected: PropTypes.bool,
}),
),

/** List of the participants */
participants: PropTypes.arrayOf(participantPropTypes),
}),
};

Expand All @@ -63,12 +68,6 @@ const defaultProps = {
attachmentInvalidReason: '',
},
report: {},
route: {
params: {
iouType: '',
reportID: '',
},
},
iou: {
id: '',
amount: 0,
Expand Down
21 changes: 13 additions & 8 deletions src/pages/iou/ReceiptSelector/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,40 @@ import Log from '../../../libs/Log';
import participantPropTypes from '../../../components/participantPropTypes';

const propTypes = {
/** Route params */
/** React Navigation route */
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,
}),
}),
}).isRequired,

/** The report on which the request is initiated on */
report: reportPropTypes,

/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,

/** Description of the request */
comment: PropTypes.string,
created: PropTypes.string,
merchant: PropTypes.string,

/** List of the participants */
participants: PropTypes.arrayOf(participantPropTypes),
}),
};

const defaultProps = {
route: {
params: {
iouType: '',
reportID: '',
},
},
report: {},
iou: {
id: '',
Expand Down
32 changes: 23 additions & 9 deletions src/pages/iou/steps/MoneyRequestConfirmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,43 @@ import ONYXKEYS from '../../../ONYXKEYS';
import withCurrentUserPersonalDetails, {withCurrentUserPersonalDetailsDefaultProps, withCurrentUserPersonalDetailsPropTypes} from '../../../components/withCurrentUserPersonalDetails';
import reportPropTypes from '../../reportPropTypes';
import personalDetailsPropType from '../../personalDetailsPropType';
import participantPropTypes from '../../../components/participantPropTypes';
import * as FileUtils from '../../../libs/fileDownload/FileUtils';
import * as Policy from '../../../libs/actions/Policy';

const propTypes = {
/** React Navigation route */
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,
}),
}).isRequired,

report: reportPropTypes,

/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,

/** Description of the request */
comment: PropTypes.string,
created: PropTypes.string,

/** Currency of the request */
currency: PropTypes.string,
merchant: PropTypes.string,
participants: PropTypes.arrayOf(
PropTypes.shape({
accountID: PropTypes.number,
login: PropTypes.string,
isPolicyExpenseChat: PropTypes.bool,
isOwnPolicyExpenseChat: PropTypes.bool,
selected: PropTypes.bool,
}),
),

/** List of the participants */
participants: PropTypes.arrayOf(participantPropTypes),
receiptPath: PropTypes.string,
}),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,31 @@ import compose from '../../../../libs/compose';
import * as DeviceCapabilities from '../../../../libs/DeviceCapabilities';
import HeaderWithBackButton from '../../../../components/HeaderWithBackButton';
import * as IOU from '../../../../libs/actions/IOU';
import participantPropTypes from '../../../../components/participantPropTypes';

const propTypes = {
/** React Navigation route */
route: PropTypes.shape({
/** Params from the route */
params: PropTypes.shape({
/** The type of IOU report, i.e. bill, request, send */
iouType: PropTypes.string,

/** The report ID of the IOU */
reportID: PropTypes.string,
}),
}).isRequired,

/** Holds data related to Money Request view state, rather than the underlying Money Request data. */
iou: PropTypes.shape({
/** ID (iouType + reportID) of the request */
id: PropTypes.string,

/** Amount of the request */
amount: PropTypes.number,
participants: PropTypes.arrayOf(
PropTypes.shape({
accountID: PropTypes.number,
login: PropTypes.string,
isPolicyExpenseChat: PropTypes.bool,
isOwnPolicyExpenseChat: PropTypes.bool,
selected: PropTypes.bool,
}),
),

/** List of the participants */
participants: PropTypes.arrayOf(participantPropTypes),
}),

...withLocalizePropTypes,
Expand Down
Loading

0 comments on commit 28065b4

Please sign in to comment.