diff --git a/STYLE.md b/STYLE.md
index eced40ceee9d..7a9fe40deed9 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -264,9 +264,7 @@ const {name, accountID, email} = data;
**React Components**
-- Avoid destructuring props and state at the *same time*. It makes the source of a given variable unclear.
-- Avoid destructuring either props or state when there are other variables declared in a render block. This helps us quickly know which variables are from props, state, or declared inside the render.
-- Use parameter destructuring for stateless function components when there are no additional variable declarations in the render.
+Don't destructure props or state. It makes the source of a given variable unclear. This guideline helps us quickly know which variables are from props, state, or from some other scope.
```javascript
// Bad
@@ -276,12 +274,20 @@ render() {
...
}
-// Good
+// Bad
const UserInfo = ({name, email}) => (
-
-
Name: {name}
-
Email: {email}
-
+
+ Name: {name}
+ Email: {email}
+
+);
+
+// Good
+const UserInfo = props => (
+
+ Name: {props.name}
+ Email: {props.email}
+
);
```
diff --git a/package-lock.json b/package-lock.json
index 88665519ed6c..3feb54dd9837 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21989,9 +21989,9 @@
}
},
"eslint-config-expensify": {
- "version": "2.0.17",
- "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.17.tgz",
- "integrity": "sha512-m+7Rsz517u+jtkmN9MqMOhQ7cUSJo07Zx7Wt1mCwOw2DjC5DDhx7iiGE12oAtsmQTR+DHMyoUY3cAUXaakeh6w==",
+ "version": "2.0.18",
+ "resolved": "https://registry.npmjs.org/eslint-config-expensify/-/eslint-config-expensify-2.0.18.tgz",
+ "integrity": "sha512-jEBAcXWm89NptiprvlBrRoDsK8zJbbkt8yVZOgzo/Vadp86gL0oc7blgyLfJHA2cjecs1kgfPYGByXb6V8v8cw==",
"dev": true,
"requires": {
"@lwc/eslint-plugin-lwc": "^0.11.0",
diff --git a/package.json b/package.json
index 4942eec533b3..b72712930259 100644
--- a/package.json
+++ b/package.json
@@ -146,7 +146,7 @@
"electron-notarize": "^1.0.0",
"electron-reloader": "^1.2.0",
"eslint": "^7.6.0",
- "eslint-config-expensify": "2.0.17",
+ "eslint-config-expensify": "^2.0.18",
"eslint-loader": "^4.0.2",
"eslint-plugin-detox": "^1.0.0",
"eslint-plugin-jest": "^24.1.0",
diff --git a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js
index 9291774806c2..295c6a6541c8 100644
--- a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js
+++ b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.js
@@ -1,3 +1,4 @@
+import _ from 'underscore';
import React from 'react';
import {Pressable, StyleSheet} from 'react-native';
import lodashGet from 'lodash/get';
@@ -9,31 +10,22 @@ import {CONTEXT_MENU_TYPES} from '../../../pages/home/report/ContextMenu/Context
import AttachmentView from '../../AttachmentView';
import fileDownload from '../../../libs/fileDownload';
-
/*
* This is a default anchor component for regular links.
*/
-const BaseAnchorForCommentsOnly = ({
- href,
- rel,
- target,
- children,
- style,
- fileName,
- ...props
-}) => {
+const BaseAnchorForCommentsOnly = (props) => {
let linkRef;
+ const rest = _.omit(props, _.keys(propTypes));
return (
-
props.isAttachment
? (
{
- fileDownload(href, fileName);
+ fileDownload(props.href, props.fileName);
}}
>
@@ -45,7 +37,7 @@ const BaseAnchorForCommentsOnly = ({
showContextMenu(
CONTEXT_MENU_TYPES.LINK,
event,
- href,
+ props.href,
lodashGet(linkRef, 'current'),
);
}
@@ -53,14 +45,17 @@ const BaseAnchorForCommentsOnly = ({
>
linkRef = el}
- style={StyleSheet.flatten(style)}
+ style={StyleSheet.flatten(props.style)}
accessibilityRole="link"
- href={href}
- hrefAttrs={{rel, target}}
- // eslint-disable-next-line react/jsx-props-no-spreading
- {...props}
+ href={props.href}
+ hrefAttrs={{
+ rel: props.rel,
+ target: props.target,
+ }}
+ // eslint-disable-next-line react/jsx-props-no-spreading
+ {...rest}
>
- {children}
+ {props.children}
)
diff --git a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.native.js b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.native.js
index 0890ba75b23c..49a3b581e27b 100644
--- a/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.native.js
+++ b/src/components/AnchorForCommentsOnly/BaseAnchorForCommentsOnly/index.native.js
@@ -1,3 +1,4 @@
+import _ from 'underscore';
import React from 'react';
import lodashGet from 'lodash/get';
import {Linking, StyleSheet, Pressable} from 'react-native';
@@ -13,27 +14,21 @@ import styles from '../../../styles/styles';
/*
* This is a default anchor component for regular links.
*/
-const BaseAnchorForCommentsOnly = ({
- href,
- children,
- style,
- isAttachment,
- fileName,
- ...props
-}) => {
+const BaseAnchorForCommentsOnly = (props) => {
let linkRef;
+ const rest = _.omit(props, _.keys(propTypes));
return (
- isAttachment
+ props.isAttachment
? (
{
- fileDownload(href, fileName);
+ fileDownload(props.href, props.fileName);
}}
>
@@ -45,20 +40,20 @@ const BaseAnchorForCommentsOnly = ({
showContextMenu(
CONTEXT_MENU_TYPES.LINK,
event,
- href,
+ props.href,
lodashGet(linkRef, 'current'),
);
}
}
- onPress={() => Linking.openURL(href)}
+ onPress={() => Linking.openURL(props.href)}
>
linkRef = el}
- style={StyleSheet.flatten(style)}
- // eslint-disable-next-line react/jsx-props-no-spreading
- {...props}
+ style={StyleSheet.flatten(props.style)}
+ // eslint-disable-next-line react/jsx-props-no-spreading
+ {...rest}
>
- {children}
+ {props.children}
)
diff --git a/src/components/AvatarWithImagePicker.js b/src/components/AvatarWithImagePicker.js
index 0243be64389c..1dacf4b88c68 100644
--- a/src/components/AvatarWithImagePicker.js
+++ b/src/components/AvatarWithImagePicker.js
@@ -157,7 +157,7 @@ class AvatarWithImagePicker extends React.Component {
}
render() {
- const {DefaultAvatar} = this.props;
+ const DefaultAvatar = this.props.DefaultAvatar;
const additionalStyles = _.isArray(this.props.style) ? this.props.style : [this.props.style];
const indicatorStyles = [
diff --git a/src/components/BigNumberPad.js b/src/components/BigNumberPad.js
index b373f07a36d9..26299c661b8f 100644
--- a/src/components/BigNumberPad.js
+++ b/src/components/BigNumberPad.js
@@ -17,7 +17,7 @@ const padNumbers = [
['.', '0', '<'],
];
-const BigNumberPad = ({numberPressed}) => (
+const BigNumberPad = props => (
{_.map(padNumbers, (row, rowIndex) => (
@@ -30,7 +30,7 @@ const BigNumberPad = ({numberPressed}) => (
key={column}
style={[styles.flex1, marginLeft]}
text={column}
- onPress={() => numberPressed(column)}
+ onPress={() => props.numberPressed(column)}
/>
);
})}
diff --git a/src/components/Button.js b/src/components/Button.js
index c62283607481..0e86f61e83f3 100644
--- a/src/components/Button.js
+++ b/src/components/Button.js
@@ -109,7 +109,7 @@ class Button extends Component {
}
renderContent() {
- const {ContentComponent} = this.props;
+ const ContentComponent = this.props.ContentComponent;
if (ContentComponent) {
return ;
}
diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js
index afd939fa9a59..970363b193ee 100644
--- a/src/components/Checkbox.js
+++ b/src/components/Checkbox.js
@@ -24,22 +24,17 @@ const defaultProps = {
disabled: false,
};
-const Checkbox = ({
- isChecked,
- onPress,
- hasError,
- disabled,
-}) => (
+const Checkbox = props => (
onPress(!isChecked)}
+ disabled={props.disabled}
+ onPress={() => props.onPress(!props.isChecked)}
>
diff --git a/src/components/CheckboxWithLabel.js b/src/components/CheckboxWithLabel.js
index db2d23ccb263..623bbce3af4a 100644
--- a/src/components/CheckboxWithLabel.js
+++ b/src/components/CheckboxWithLabel.js
@@ -38,26 +38,25 @@ const defaultProps = {
errorText: '',
};
-const CheckboxWithLabel = ({
- LabelComponent, isChecked, onPress, style, label, hasError, errorText,
-}) => {
+const CheckboxWithLabel = (props) => {
+ const LabelComponent = props.LabelComponent;
const defaultStyles = [styles.flexRow, styles.alignItemsCenter];
- const wrapperStyles = _.isArray(style) ? [...defaultStyles, ...style] : [...defaultStyles, style];
+ const wrapperStyles = _.isArray(props.style) ? [...defaultStyles, ...props.style] : [...defaultStyles, props.style];
- if (!label && !LabelComponent) {
+ if (!props.label && !LabelComponent) {
throw new Error('Must provide at least label or LabelComponent prop');
}
return (
<>
onPress(!isChecked)}
- label={label}
- hasError={hasError}
+ isChecked={props.isChecked}
+ onPress={() => props.onPress(!props.isChecked)}
+ label={props.label}
+ hasError={props.hasError}
/>
onPress(!isChecked)}
+ onPress={() => props.onPress(!props.isChecked)}
style={[
styles.ml3,
styles.pr2,
@@ -68,17 +67,17 @@ const CheckboxWithLabel = ({
styles.alignItemsCenter,
]}
>
- {label && (
+ {props.label && (
- {label}
+ {props.label}
)}
{LabelComponent && ( )}
- {!_.isEmpty(errorText) && (
+ {!_.isEmpty(props.errorText) && (
- {errorText}
+ {props.errorText}
)}
>
diff --git a/src/components/DatePicker/index.android.js b/src/components/DatePicker/index.android.js
index cbc726688d1b..d4b2bfa4cf50 100644
--- a/src/components/DatePicker/index.android.js
+++ b/src/components/DatePicker/index.android.js
@@ -38,36 +38,25 @@ class DatePicker extends React.Component {
}
render() {
- const {
- value,
- label,
- placeholder,
- hasError,
- errorText,
- translateX,
- containerStyles,
- disabled,
- } = this.props;
-
- const dateAsText = value ? moment(value).format(CONST.DATE.MOMENT_FORMAT_STRING) : '';
+ const dateAsText = this.props.value ? moment(this.props.value).format(CONST.DATE.MOMENT_FORMAT_STRING) : '';
return (
<>
{this.state.isPickerVisible && (
diff --git a/src/components/DatePicker/index.ios.js b/src/components/DatePicker/index.ios.js
index 127523b267cc..b29ae3b02bc9 100644
--- a/src/components/DatePicker/index.ios.js
+++ b/src/components/DatePicker/index.ios.js
@@ -64,32 +64,20 @@ class Datepicker extends React.Component {
}
render() {
- const {
- value,
- label,
- placeholder,
- hasError,
- errorText,
- translateX,
- containerStyles,
- disabled,
- } = this.props;
-
- const dateAsText = value ? moment(value).format(CONST.DATE.MOMENT_FORMAT_STRING) : '';
-
+ const dateAsText = this.props.value ? moment(this.props.value).format(CONST.DATE.MOMENT_FORMAT_STRING) : '';
return (
<>
this.inputRef = input}
onFocus={this.showDatepicker}
- label={label}
+ label={this.props.label}
onChangeText={this.raiseDateChange}
defaultValue={this.defaultValue}
- placeholder={placeholder}
- hasError={hasError}
- errorText={errorText}
- containerStyles={containerStyles}
- translateX={translateX}
- disabled={disabled}
+ placeholder={this.props.placeholder}
+ hasError={this.props.hasError}
+ errorText={this.props.errorText}
+ containerStyles={this.props.containerStyles}
+ translateX={this.props.translateX}
+ disabled={this.props.disabled}
/>
);
}
diff --git a/src/components/DisplayNames/index.native.js b/src/components/DisplayNames/index.native.js
index a3862e5eb147..6ccb53888fd6 100644
--- a/src/components/DisplayNames/index.native.js
+++ b/src/components/DisplayNames/index.native.js
@@ -3,13 +3,9 @@ import {propTypes, defaultProps} from './displayNamesPropTypes';
import Text from '../Text';
// As we don't have to show tooltips of the Native platform so we simply render the full display names list.
-const DisplayNames = ({
- fullTitle,
- numberOfLines,
- textStyles,
-}) => (
-
- {fullTitle}
+const DisplayNames = props => (
+
+ {props.fullTitle}
);
diff --git a/src/components/ExpensiPicker.js b/src/components/ExpensiPicker.js
index bbb9db50b336..3f67d0352415 100644
--- a/src/components/ExpensiPicker.js
+++ b/src/components/ExpensiPicker.js
@@ -36,26 +36,24 @@ class ExpensiPicker extends PureComponent {
}
render() {
- const {
- label, isDisabled, ...pickerProps
- } = this.props;
+ const pickerProps = _.omit(this.props, _.keys(propTypes));
return (
<>
- {label && (
- {label}
+ {this.props.label && (
+ {this.props.label}
)}
this.setState({isOpen: true})}
onClose={() => this.setState({isOpen: false})}
- disabled={isDisabled}
+ disabled={this.props.isDisabled}
// eslint-disable-next-line react/jsx-props-no-spreading
{...pickerProps}
/>
diff --git a/src/components/ExpensiTextInput/BaseExpensiTextInput.js b/src/components/ExpensiTextInput/BaseExpensiTextInput.js
index b22eaa55b2b2..abfbfd1bcddd 100644
--- a/src/components/ExpensiTextInput/BaseExpensiTextInput.js
+++ b/src/components/ExpensiTextInput/BaseExpensiTextInput.js
@@ -146,28 +146,14 @@ class BaseExpensiTextInput extends Component {
}
render() {
- const {
- label,
- value,
- placeholder,
- errorText,
- hasError,
- containerStyles,
- inputStyle,
- ignoreLabelTranslateX,
- innerRef,
- autoFocus,
- multiline,
- ...inputProps
- } = this.props;
-
- const hasLabel = Boolean(label.length);
+ const inputProps = _.omit(this.props, _.keys(propTypes));
+ const hasLabel = Boolean(this.props.label.length);
return (
@@ -175,18 +161,18 @@ class BaseExpensiTextInput extends Component {
style={[
styles.expensiTextInputContainer,
this.state.isFocused && styles.borderColorFocus,
- (hasError || errorText) && styles.borderColorDanger,
+ (this.props.hasError || this.props.errorText) && styles.borderColorDanger,
]}
>
{hasLabel ? (
<>
{/* Adding this background to the label only for multiline text input,
to prevent text overlaping with label when scrolling */}
- {multiline && }
+ {this.props.multiline && }
{
- if (typeof innerRef === 'function') { innerRef(ref); }
+ if (typeof this.props.innerRef === 'function') { this.props.innerRef(ref); }
this.input = ref;
}}
// eslint-disable-next-line
{...inputProps}
- value={value}
- placeholder={(this.state.isFocused || !label) ? placeholder : null}
+ value={this.props.value}
+ placeholder={(this.state.isFocused || !this.props.label) ? this.props.placeholder : null}
placeholderTextColor={themeColors.placeholderText}
underlineColorAndroid="transparent"
- style={[inputStyle, !hasLabel && styles.pv0]}
- multiline={multiline}
+ style={[this.props.inputStyle, !hasLabel && styles.pv0]}
+ multiline={this.props.multiline}
onFocus={this.onFocus}
onBlur={this.onBlur}
onChangeText={this.setValue}
@@ -216,9 +202,9 @@ class BaseExpensiTextInput extends Component {
- {!_.isEmpty(errorText) && (
+ {!_.isEmpty(this.props.errorText) && (
- {errorText}
+ {this.props.errorText}
)}
diff --git a/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.js b/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.js
index 88d5194a5f29..5293e90f7960 100644
--- a/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.js
+++ b/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.js
@@ -3,25 +3,20 @@ import {Animated} from 'react-native';
import styles from '../../../styles/styles';
import propTypes from './expensiTextInputLabelPropTypes';
-const ExpensiTextInputLabel = ({
- label,
- labelTranslateY,
- labelTranslateX,
- labelScale,
-}) => (
+const ExpensiTextInputLabel = props => (
- {label}
+ {props.label}
);
diff --git a/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.native.js b/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.native.js
index 082333f55254..8869584504e2 100644
--- a/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.native.js
+++ b/src/components/ExpensiTextInput/ExpensiTextInputLabel/index.native.js
@@ -3,23 +3,18 @@ import {Animated} from 'react-native';
import styles from '../../../styles/styles';
import propTypes from './expensiTextInputLabelPropTypes';
-const ExpensiTextInputLabel = ({
- label,
- labelTranslateX,
- labelTranslateY,
- labelScale,
-}) => (
+const ExpensiTextInputLabel = props => (
- {label}
+ {props.label}
);
diff --git a/src/components/FAB/index.ios.js b/src/components/FAB/index.ios.js
index 863ac8f9fac0..3ebc24dcd62d 100644
--- a/src/components/FAB/index.ios.js
+++ b/src/components/FAB/index.ios.js
@@ -7,9 +7,9 @@ import FAB from './FAB';
import fabPropTypes from './fabPropTypes';
// KeyboardAvoidingView only need in IOS so that's the reason make platform specific FAB component.
-const Fab = ({onPress, isActive}) => (
+const Fab = props => (
-
+
);
diff --git a/src/components/FormAlertWithSubmitButton.js b/src/components/FormAlertWithSubmitButton.js
index 077814e11f2c..d7db46120845 100644
--- a/src/components/FormAlertWithSubmitButton.js
+++ b/src/components/FormAlertWithSubmitButton.js
@@ -51,48 +51,37 @@ const defaultProps = {
isLoading: false,
};
-const FormAlertWithSubmitButton = ({
- isAlertVisible,
- isDisabled,
- onSubmit,
- buttonText,
- translate,
- onFixTheErrorsLinkPressed,
- message,
- isMessageHtml,
- containerStyles,
- isLoading,
-}) => {
+const FormAlertWithSubmitButton = (props) => {
/**
* @returns {React.Component}
*/
function getAlertPrompt() {
let error = '';
- if (!_.isEmpty(message)) {
- if (isMessageHtml) {
+ if (!_.isEmpty(props.message)) {
+ if (props.isMessageHtml) {
error = (
- ${message}`} />
+ ${props.message}`} />
);
} else {
error = (
- {message}
+ {props.message}
);
}
} else {
error = (
<>
- {`${translate('common.please')} `}
+ {`${props.translate('common.please')} `}
- {translate('common.fixTheErrors')}
+ {props.translate('common.fixTheErrors')}
- {` ${translate('common.inTheFormBeforeContinuing')}.`}
+ {` ${props.translate('common.inTheFormBeforeContinuing')}.`}
>
);
@@ -106,8 +95,8 @@ const FormAlertWithSubmitButton = ({
}
return (
-
- {isAlertVisible && (
+
+ {props.isAlertVisible && (
{getAlertPrompt()}
@@ -116,10 +105,10 @@ const FormAlertWithSubmitButton = ({
);
diff --git a/src/components/FullNameInputRow.js b/src/components/FullNameInputRow.js
index 3aa4fff516a0..ade8c5647467 100644
--- a/src/components/FullNameInputRow.js
+++ b/src/components/FullNameInputRow.js
@@ -41,33 +41,27 @@ const defaultProps = {
style: {},
};
-const FullNameInputRow = ({
- translate,
- onChangeFirstName, onChangeLastName,
- firstName, firstNameError,
- lastName, lastNameError,
- style,
-}) => {
- const additionalStyles = _.isArray(style) ? style : [style];
+const FullNameInputRow = (props) => {
+ const additionalStyles = _.isArray(props.style) ? props.style : [props.style];
return (
diff --git a/src/components/FullscreenLoadingIndicator.js b/src/components/FullscreenLoadingIndicator.js
index e8efeb754740..41a2ef2f8436 100644
--- a/src/components/FullscreenLoadingIndicator.js
+++ b/src/components/FullscreenLoadingIndicator.js
@@ -22,14 +22,15 @@ const defaultProps = {
/**
* Loading indication component intended to cover the whole page, while the page prepares for initial render
*
+ * @param {Object} props
* @returns {JSX.Element}
*/
-const FullScreenLoadingIndicator = ({visible, style}) => {
- if (!visible) {
+const FullScreenLoadingIndicator = (props) => {
+ if (!props.visible) {
return null;
}
- const additionalStyles = _.isArray(style) ? style : [style];
+ const additionalStyles = _.isArray(props.style) ? props.style : [props.style];
return (
diff --git a/src/components/GrowlNotification/GrowlNotificationContainer/index.js b/src/components/GrowlNotification/GrowlNotificationContainer/index.js
index afed2dfbfc68..366f0294413b 100644
--- a/src/components/GrowlNotification/GrowlNotificationContainer/index.js
+++ b/src/components/GrowlNotification/GrowlNotificationContainer/index.js
@@ -9,16 +9,16 @@ const propTypes = {
...windowDimensionsPropTypes,
};
-const GrowlNotificationContainer = ({children, translateY, isSmallScreenWidth}) => (
+const GrowlNotificationContainer = props => (
- {children}
+ {props.children}
);
diff --git a/src/components/GrowlNotification/GrowlNotificationContainer/index.native.js b/src/components/GrowlNotification/GrowlNotificationContainer/index.native.js
index e2a07b15251b..c90aa162b5a1 100644
--- a/src/components/GrowlNotification/GrowlNotificationContainer/index.native.js
+++ b/src/components/GrowlNotification/GrowlNotificationContainer/index.native.js
@@ -8,17 +8,17 @@ const propTypes = {
...growlNotificationContainerPropTypes,
};
-const GrowlNotificationContainer = ({children, translateY}) => (
+const GrowlNotificationContainer = props => (
{insets => (
- {children}
+ {props.children}
)}
diff --git a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
index d0b8a3d6723e..df9ea311b695 100755
--- a/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
+++ b/src/components/HTMLEngineProvider/BaseHTMLEngineProvider.js
@@ -83,13 +83,13 @@ function isInsideComment(tnode) {
return false;
}
-function AnchorRenderer({tnode, key, style}) {
- const htmlAttribs = tnode.attributes;
+function AnchorRenderer(props) {
+ const htmlAttribs = props.tnode.attributes;
// An auth token is needed to download Expensify chat attachments
const isAttachment = Boolean(htmlAttribs['data-expensify-source']);
- const fileName = lodashGet(tnode, 'domNode.children[0].data', '');
- const parentStyle = lodashGet(tnode, 'parent.styles.nativeTextRet', {});
+ const fileName = lodashGet(props.tnode, 'domNode.children[0].data', '');
+ const parentStyle = lodashGet(props.tnode, 'parent.styles.nativeTextRet', {});
const internalExpensifyPath = (htmlAttribs.href.startsWith(CONST.NEW_EXPENSIFY_URL) && htmlAttribs.href.replace(CONST.NEW_EXPENSIFY_URL, ''))
|| (htmlAttribs.href.startsWith(CONST.STAGING_NEW_EXPENSIFY_URL) && htmlAttribs.href.replace(CONST.STAGING_NEW_EXPENSIFY_URL, ''));
@@ -101,12 +101,12 @@ function AnchorRenderer({tnode, key, style}) {
style={styles.link}
onPress={() => Navigation.navigate(internalExpensifyPath)}
>
-
+
);
}
- if (!isInsideComment(tnode)) {
+ if (!isInsideComment(props.tnode)) {
// This is not a comment from a chat, the AnchorForCommentsOnly uses a Pressable to create a context menu on right click.
// We don't have this behaviour in other links in NewDot
// TODO: We should use TextLink, but I'm leaving it as Text for now because TextLink breaks the alignment in Android.
@@ -117,7 +117,7 @@ function AnchorRenderer({tnode, key, style}) {
Linking.openURL(htmlAttribs.href);
}}
>
-
+
);
}
@@ -134,21 +134,19 @@ function AnchorRenderer({tnode, key, style}) {
// eslint-disable-next-line react/jsx-props-no-multi-spaces
target={htmlAttribs.target || '_blank'}
rel={htmlAttribs.rel || 'noopener noreferrer'}
- style={{...style, ...parentStyle}}
- key={key}
+ style={{...props.style, ...parentStyle}}
+ key={props.key}
fileName={fileName}
>
-
+
);
}
-function CodeRenderer({
- key, style, TDefaultRenderer, ...defaultRendererProps
-}) {
+function CodeRenderer(props) {
// We split wrapper and inner styles
// "boxModelStyle" corresponds to border, margin, padding and backgroundColor
- const {boxModelStyle, otherStyle: textStyle} = splitBoxModelStyle(style);
+ const {boxModelStyle, otherStyle: textStyle} = splitBoxModelStyle(props.style);
// Get the correct fontFamily variant based in the fontStyle and fontWeight
const font = getFontFamilyMonospace({
@@ -168,11 +166,11 @@ function CodeRenderer({
return (
);
}
@@ -193,8 +191,8 @@ function EditedRenderer(props) {
);
}
-function ImgRenderer({tnode}) {
- const htmlAttribs = tnode.attributes;
+function ImgRenderer(props) {
+ const htmlAttribs = props.tnode.attributes;
// There are two kinds of images that need to be displayed:
//
@@ -289,9 +287,9 @@ const defaultViewProps = {style: {alignItems: 'flex-start'}};
// context to RenderHTMLSource components. See https://git.io/JRcZb
// Beware that each prop should be referentialy stable between renders to avoid
// costly invalidations and commits.
-const BaseHTMLEngineProvider = ({children, textSelectable}) => {
+const BaseHTMLEngineProvider = (props) => {
// We need to memoize this prop to make it referentially stable.
- const defaultTextProps = useMemo(() => ({selectable: textSelectable}), [textSelectable]);
+ const defaultTextProps = useMemo(() => ({selectable: props.textSelectable}), [props.textSelectable]);
return (
{
renderersProps={renderersProps}
computeEmbeddedMaxWidth={computeEmbeddedMaxWidth}
>
- {children}
+ {props.children}
);
diff --git a/src/components/HTMLEngineProvider/index.js b/src/components/HTMLEngineProvider/index.js
index a96bccad3c2e..627eb081c8d8 100755
--- a/src/components/HTMLEngineProvider/index.js
+++ b/src/components/HTMLEngineProvider/index.js
@@ -4,12 +4,12 @@ import {defaultProps, propTypes} from './htmlEnginePropTypes';
import withWindowDimensions from '../withWindowDimensions';
import canUseTouchScreen from '../../libs/canUseTouchscreen';
-const HTMLEngineProvider = ({isSmallScreenWidth, debug, children}) => (
+const HTMLEngineProvider = props => (
- {children}
+ {props.children}
);
diff --git a/src/components/HTMLEngineProvider/index.native.js b/src/components/HTMLEngineProvider/index.native.js
index b524495e7084..3c8c0949515d 100755
--- a/src/components/HTMLEngineProvider/index.native.js
+++ b/src/components/HTMLEngineProvider/index.native.js
@@ -2,9 +2,9 @@ import React from 'react';
import BaseHTMLEngineProvider from './BaseHTMLEngineProvider';
import {propTypes, defaultProps} from './htmlEnginePropTypes';
-const HTMLEngineProvider = ({debug, children}) => (
-
- {children}
+const HTMLEngineProvider = props => (
+
+ {props.children}
);
diff --git a/src/components/InlineCodeBlock/index.js b/src/components/InlineCodeBlock/index.js
index 29bdf38ace1e..358fc4e05b99 100644
--- a/src/components/InlineCodeBlock/index.js
+++ b/src/components/InlineCodeBlock/index.js
@@ -2,23 +2,21 @@ import React from 'react';
import {Text} from 'react-native';
import inlineCodeBlockPropTypes from './inlineCodeBlockPropTypes';
-const InlineCodeBlock = ({
- TDefaultRenderer,
- defaultRendererProps,
- boxModelStyle,
- textStyle,
-}) => (
-
- {
+ const TDefaultRenderer = props.TDefaultRenderer;
+ return (
+
- {defaultRendererProps.tnode.data}
-
-
-);
+
+ {props.defaultRendererProps.tnode.data}
+
+
+ );
+};
InlineCodeBlock.propTypes = inlineCodeBlockPropTypes;
InlineCodeBlock.displayName = 'InlineCodeBlock';
diff --git a/src/components/InlineCodeBlock/index.native.js b/src/components/InlineCodeBlock/index.native.js
index 621247f68cce..8431ce61e891 100644
--- a/src/components/InlineCodeBlock/index.native.js
+++ b/src/components/InlineCodeBlock/index.native.js
@@ -3,27 +3,25 @@ import styles from '../../styles/styles';
import WrappedText from './WrappedText';
import inlineCodeBlockPropTypes from './inlineCodeBlockPropTypes';
-const InlineCodeBlock = ({
- TDefaultRenderer,
- defaultRendererProps,
- boxModelStyle,
- textStyle,
-}) => (
-
- {
+ const TDefaultRenderer = props.TDefaultRenderer;
+ return (
+
- {defaultRendererProps.tnode.data}
-
-
-);
+
+ {props.defaultRendererProps.tnode.data}
+
+
+ );
+};
InlineCodeBlock.propTypes = inlineCodeBlockPropTypes;
InlineCodeBlock.displayName = 'InlineCodeBlock';
diff --git a/src/components/KeyboardAvoidingView/index.ios.js b/src/components/KeyboardAvoidingView/index.ios.js
index 89ef7e033f02..70373a2e5713 100644
--- a/src/components/KeyboardAvoidingView/index.ios.js
+++ b/src/components/KeyboardAvoidingView/index.ios.js
@@ -1,6 +1,5 @@
-/**
+/*
* This is a KeyboardAvoidingView only enabled for ios && disabled for all other platforms
- * @param {Node}
*/
import React from 'react';
import {KeyboardAvoidingView as KeyboardAvoidingViewComponent} from 'react-native';
@@ -14,16 +13,14 @@ const defaultProps = {
children: null,
};
-function KeyboardAvoidingView({children}) {
- return (
-
- {children}
-
- );
-}
+const KeyboardAvoidingView = props => (
+
+ {props.children}
+
+);
KeyboardAvoidingView.propTypes = propTypes;
KeyboardAvoidingView.defaultProps = defaultProps;
diff --git a/src/components/KeyboardAvoidingView/index.js b/src/components/KeyboardAvoidingView/index.js
index 985240a00777..a25ad6a95963 100644
--- a/src/components/KeyboardAvoidingView/index.js
+++ b/src/components/KeyboardAvoidingView/index.js
@@ -1,6 +1,5 @@
-/**
+/*
* This is a KeyboardAvoidingView only enabled for ios && disabled for all other platforms
- * @param {Node}
*/
import PropTypes from 'prop-types';
diff --git a/src/components/LocalePicker.js b/src/components/LocalePicker.js
index bcce87b246f2..2a58b1b53fd4 100644
--- a/src/components/LocalePicker.js
+++ b/src/components/LocalePicker.js
@@ -41,27 +41,24 @@ const localesToLanguages = {
},
};
-const LocalePicker = ({
- // eslint-disable-next-line no-shadow
- preferredLocale, translate, betas, size,
-}) => {
- if (!Permissions.canUseInternationalization(betas)) {
+const LocalePicker = (props) => {
+ if (!Permissions.canUseInternationalization(props.betas)) {
return null;
}
return (
{
- if (locale === preferredLocale) {
+ if (locale === props.preferredLocale) {
return;
}
- setLocale(locale);
+ setLocale();
}}
items={_.values(localesToLanguages)}
- size={size}
- value={preferredLocale}
+ size={props.size}
+ value={props.preferredLocale}
/>
);
};
diff --git a/src/components/MenuItem.js b/src/components/MenuItem.js
index 44da7b8a75b8..0e4d23b38b4f 100644
--- a/src/components/MenuItem.js
+++ b/src/components/MenuItem.js
@@ -37,71 +37,52 @@ const defaultProps = {
interactive: true,
};
-const MenuItem = ({
- badgeText,
- onPress,
- icon,
- iconRight,
- title,
- shouldShowRightIcon,
- wrapperStyle,
- success,
- iconWidth,
- iconHeight,
- description,
- iconStyles,
- iconFill,
- focused,
- disabled,
- subtitle,
- iconType,
- interactive,
-}) => (
+const MenuItem = props => (
{
- if (disabled) {
+ if (props.disabled) {
return;
}
- onPress(e);
+ props.onPress(e);
}}
style={({hovered, pressed}) => ([
styles.popoverMenuItem,
- getButtonBackgroundColorStyle(getButtonState(focused || hovered, pressed, success, disabled, interactive)),
- ..._.isArray(wrapperStyle) ? wrapperStyle : [wrapperStyle],
+ getButtonBackgroundColorStyle(getButtonState(props.focused || hovered, pressed, props.success, props.disabled, props.interactive)),
+ ..._.isArray(props.wrapperStyle) ? props.wrapperStyle : [props.wrapperStyle],
])}
- disabled={disabled}
+ disabled={props.disabled}
>
{({hovered, pressed}) => (
<>
- {(icon && iconType === CONST.ICON_TYPE_ICON) && (
+ {(props.icon && props.iconType === CONST.ICON_TYPE_ICON) && (
)}
- {(icon && iconType === CONST.ICON_TYPE_AVATAR) && (
+ {(props.icon && props.iconType === CONST.ICON_TYPE_AVATAR) && (
)}
@@ -110,35 +91,35 @@ const MenuItem = ({
style={[
styles.popoverMenuText,
styles.ml3,
- (interactive && disabled ? styles.disabledText : undefined),
+ (props.interactive && props.disabled ? styles.disabledText : undefined),
]}
numberOfLines={1}
>
- {title}
+ {props.title}
- {description && (
+ {props.description && (
- {description}
+ {props.description}
)}
- {badgeText && }
- {subtitle && (
+ {props.badgeText && }
+ {props.subtitle && (
- {subtitle}
+ {props.subtitle}
)}
- {shouldShowRightIcon && (
+ {props.shouldShowRightIcon && (
)}
diff --git a/src/components/MenuItemList.js b/src/components/MenuItemList.js
index 3ffa6aa98063..e442d3766893 100644
--- a/src/components/MenuItemList.js
+++ b/src/components/MenuItemList.js
@@ -12,9 +12,9 @@ const defaultProps = {
menuItems: [],
};
-const MenuItemList = ({menuItems}) => (
+const MenuItemList = props => (
<>
- {_.map(menuItems, menuItemProps => (
+ {_.map(props.menuItems, menuItemProps => (
{
- const avatarContainerStyles = size === 'small' ? styles.emptyAvatarSmall : styles.emptyAvatar;
- const singleAvatarStyles = size === 'small' ? styles.singleAvatarSmall : styles.singleAvatar;
+const MultipleAvatars = (props) => {
+ const avatarContainerStyles = props.size === 'small' ? styles.emptyAvatarSmall : styles.emptyAvatar;
+ const singleAvatarStyles = props.size === 'small' ? styles.singleAvatarSmall : styles.singleAvatar;
const secondAvatarStyles = [
- size === 'small' ? styles.secondAvatarSmall : styles.secondAvatar,
- ...secondAvatarStyle,
+ props.size === 'small' ? styles.secondAvatarSmall : styles.secondAvatar,
+ ...props.secondAvatarStyle,
];
- if (!avatarImageURLs.length) {
+ if (!props.avatarImageURLs.length) {
return null;
}
- if (avatarImageURLs.length === 1) {
+ if (props.avatarImageURLs.length === 1) {
return (
);
@@ -64,26 +62,26 @@ const MultipleAvatars = ({
style={singleAvatarStyles}
>
- {avatarImageURLs.length === 2 ? (
+ {props.avatarImageURLs.length === 2 ? (
) : (
-
- {`+${avatarImageURLs.length - 1}`}
+ {`+${props.avatarImageURLs.length - 1}`}
)}
diff --git a/src/components/PDFView/index.js b/src/components/PDFView/index.js
index fc0ed0bd5393..74b2ec33747d 100644
--- a/src/components/PDFView/index.js
+++ b/src/components/PDFView/index.js
@@ -44,11 +44,10 @@ class PDFView extends PureComponent {
}
render() {
- const {isSmallScreenWidth} = this.props;
const pdfContainerWidth = this.state.windowWidth - 100;
const pageWidthOnLargeScreen = (pdfContainerWidth <= variables.pdfPageMaxWidth)
? pdfContainerWidth : variables.pdfPageMaxWidth;
- const pageWidth = isSmallScreenWidth ? this.state.windowWidth - 30 : pageWidthOnLargeScreen;
+ const pageWidth = this.props.isSmallScreenWidth ? this.state.windowWidth - 30 : pageWidthOnLargeScreen;
return (
(
+const Picker = props => (
icon(size)}
- disabled={disabled}
+ placeholder={props.placeholder}
+ value={props.value}
+ Icon={() => props.icon(props.size)}
+ disabled={props.disabled}
fixAndroidTouchableBug
- onOpen={onOpen}
- onClose={onClose}
+ onOpen={props.onOpen}
+ onClose={props.onClose}
pickerProps={{
- onFocus: onOpen,
- onBlur: onClose,
+ onFocus: props.onOpen,
+ onBlur: props.onClose,
}}
/>
);
diff --git a/src/components/ReimbursementAccountLoadingIndicator.js b/src/components/ReimbursementAccountLoadingIndicator.js
index c949cbecfba9..8c122600f162 100644
--- a/src/components/ReimbursementAccountLoadingIndicator.js
+++ b/src/components/ReimbursementAccountLoadingIndicator.js
@@ -17,13 +17,13 @@ const propTypes = {
...withLocalizePropTypes,
};
-const ReimbursementAccountLoadingIndicator = ({translate, isSubmittingVerificationsData}) => (
+const ReimbursementAccountLoadingIndicator = props => (
- {isSubmittingVerificationsData ? (
+ {props.isSubmittingVerificationsData ? (
- {translate('reimbursementAccountLoadingAnimation.explanationLine')}
+ {props.translate('reimbursementAccountLoadingAnimation.explanationLine')}
diff --git a/src/components/RenderHTML.js b/src/components/RenderHTML.js
index 74f8a888b2e0..de3b15b8567e 100644
--- a/src/components/RenderHTML.js
+++ b/src/components/RenderHTML.js
@@ -3,25 +3,27 @@ import {useWindowDimensions} from 'react-native';
import PropTypes from 'prop-types';
import {RenderHTMLSource} from 'react-native-render-html';
+const propTypes = {
+ /** HTML string to render */
+ html: PropTypes.string.isRequired,
+};
+
// We are using the explicit composite architecture for performance gains.
// Configuration for RenderHTML is handled in a top-level component providing
// context to RenderHTMLSource components. See https://git.io/JRcZb
// The provider is available at src/components/HTMLEngineProvider/
-const RenderHTML = ({html}) => {
+const RenderHTML = (props) => {
const {width} = useWindowDimensions();
return (
);
};
RenderHTML.displayName = 'RenderHTML';
-RenderHTML.propTypes = {
- /** HTML string to render */
- html: PropTypes.string.isRequired,
-};
+RenderHTML.propTypes = propTypes;
RenderHTML.defaultProps = {};
export default RenderHTML;
diff --git a/src/components/ReportActionItem/IOUAction.js b/src/components/ReportActionItem/IOUAction.js
index 399e706170cd..d172db8845fd 100644
--- a/src/components/ReportActionItem/IOUAction.js
+++ b/src/components/ReportActionItem/IOUAction.js
@@ -32,26 +32,22 @@ const defaultProps = {
},
};
-const IOUAction = ({
- action,
- chatReportID,
- isMostRecentIOUReportAction,
-}) => {
+const IOUAction = (props) => {
const launchDetailsModal = () => {
- Navigation.navigate(ROUTES.getIouDetailsRoute(chatReportID, action.originalMessage.IOUReportID));
+ Navigation.navigate(ROUTES.getIouDetailsRoute(props.chatReportID, props.action.originalMessage.IOUReportID));
};
return (
<>
- {((isMostRecentIOUReportAction && Boolean(action.originalMessage.IOUReportID))
- || (action.originalMessage.type === 'pay')) && (
+ {((props.isMostRecentIOUReportAction && Boolean(props.action.originalMessage.IOUReportID))
+ || (props.action.originalMessage.type === 'pay')) && (
diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js
index 30b62e7447dc..92ec8b48d3a0 100644
--- a/src/components/ReportActionItem/IOUPreview.js
+++ b/src/components/ReportActionItem/IOUPreview.js
@@ -74,45 +74,35 @@ const defaultProps = {
onPayButtonPressed: null,
};
-const IOUPreview = ({
- iouReportID,
- chatReportID,
- iouReport,
- personalDetails,
- session,
- shouldHidePayButton,
- onPayButtonPressed,
- onPreviewPressed,
- translate,
-}) => {
+const IOUPreview = (props) => {
// Usually the parent determines whether the IOU Preview is displayed. But as the iouReport total cannot be known
// until it is stored locally, we need to make this check within the Component after retrieving it. This allows us
// to handle the loading UI from within this Component instead of needing to declare it within each parent, which
// would duplicate and complicate the logic
- if (iouReport.total === 0) {
+ if (props.iouReport.total === 0) {
return null;
}
- const sessionEmail = lodashGet(session, 'email', null);
- const managerEmail = iouReport.managerEmail || '';
- const ownerEmail = iouReport.ownerEmail || '';
+ const sessionEmail = lodashGet(props.session, 'email', null);
+ const managerEmail = props.iouReport.managerEmail || '';
+ const ownerEmail = props.iouReport.ownerEmail || '';
// Pay button should only be visible to the manager of the report.
const isCurrentUserManager = managerEmail === sessionEmail;
- const reportIsLoading = _.isEmpty(iouReport);
+ const reportIsLoading = _.isEmpty(props.iouReport);
if (reportIsLoading) {
- fetchIOUReportByID(iouReportID, chatReportID);
+ fetchIOUReportByID(props.iouReportID, props.chatReportID);
}
- const managerName = lodashGet(personalDetails, [managerEmail, 'firstName'], '')
+ const managerName = lodashGet(props.personalDetails, [managerEmail, 'firstName'], '')
|| Str.removeSMSDomain(managerEmail);
- const ownerName = lodashGet(personalDetails, [ownerEmail, 'firstName'], '') || Str.removeSMSDomain(ownerEmail);
- const managerAvatar = lodashGet(personalDetails, [managerEmail, 'avatar'], '');
- const ownerAvatar = lodashGet(personalDetails, [ownerEmail, 'avatar'], '');
- const cachedTotal = iouReport.cachedTotal ? iouReport.cachedTotal.replace(/[()]/g, '') : '';
+ const ownerName = lodashGet(props.personalDetails, [ownerEmail, 'firstName'], '') || Str.removeSMSDomain(ownerEmail);
+ const managerAvatar = lodashGet(props.personalDetails, [managerEmail, 'avatar'], '');
+ const ownerAvatar = lodashGet(props.personalDetails, [ownerEmail, 'avatar'], '');
+ const cachedTotal = props.iouReport.cachedTotal ? props.iouReport.cachedTotal.replace(/[()]/g, '') : '';
return (
-
+
{reportIsLoading
?
@@ -124,7 +114,7 @@ const IOUPreview = ({
{cachedTotal}
- {!iouReport.hasOutstandingIOU && (
+ {!props.iouReport.hasOutstandingIOU && (
@@ -139,16 +129,16 @@ const IOUPreview = ({
- {iouReport.hasOutstandingIOU
- ? translate('iou.owes', {manager: managerName, owner: ownerName})
- : translate('iou.paid', {manager: managerName, owner: ownerName})}
+ {props.iouReport.hasOutstandingIOU
+ ? props.translate('iou.owes', {manager: managerName, owner: ownerName})
+ : props.translate('iou.paid', {manager: managerName, owner: ownerName})}
{(isCurrentUserManager
- && !shouldHidePayButton
- && iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && (
+ && !props.shouldHidePayButton
+ && props.iouReport.stateNum === CONST.REPORT.STATE_NUM.PROCESSING && (
- {translate('iou.pay')}
+ {props.translate('iou.pay')}
))}
diff --git a/src/components/ReportActionItem/IOUQuote.js b/src/components/ReportActionItem/IOUQuote.js
index 78d1019be854..6e8a5f9e51a0 100644
--- a/src/components/ReportActionItem/IOUQuote.js
+++ b/src/components/ReportActionItem/IOUQuote.js
@@ -25,24 +25,19 @@ const defaultProps = {
onViewDetailsPressed: () => {},
};
-const IOUQuote = ({
- action,
- shouldShowViewDetailsLink,
- onViewDetailsPressed,
- translate,
-}) => (
+const IOUQuote = props => (
- {_.map(action.message, (fragment, index) => (
-
+ {_.map(props.action.message, (fragment, index) => (
+
{fragment.text}
- {shouldShowViewDetailsLink && (
+ {props.shouldShowViewDetailsLink && (
- {translate('iou.viewDetails')}
+ {props.translate('iou.viewDetails')}
)}
diff --git a/src/components/SVGImage/index.js b/src/components/SVGImage/index.js
index ad957895b79d..be19eb3d0841 100644
--- a/src/components/SVGImage/index.js
+++ b/src/components/SVGImage/index.js
@@ -3,10 +3,10 @@ import {Image} from 'react-native';
import {getWidthAndHeightStyle} from '../../styles/styles';
import propTypes from './propTypes';
-const SVGImage = ({width, height, src}) => (
+const SVGImage = props => (
);
diff --git a/src/components/SVGImage/index.native.js b/src/components/SVGImage/index.native.js
index ca7df2868c49..a34552c7d90b 100644
--- a/src/components/SVGImage/index.native.js
+++ b/src/components/SVGImage/index.native.js
@@ -2,11 +2,11 @@ import React from 'react';
import {SvgCssUri} from 'react-native-svg';
import propTypes from './propTypes';
-const SVGImage = ({width, height, src}) => (
+const SVGImage = props => (
);
diff --git a/src/components/Switch.js b/src/components/Switch.js
index 73ec6ea5986b..e4de23650556 100644
--- a/src/components/Switch.js
+++ b/src/components/Switch.js
@@ -39,13 +39,11 @@ class Switch extends Component {
render() {
const switchTransform = {transform: [{translateX: this.offsetX}]};
- const {isOn, onToggle} = this.props;
-
return (
onToggle(!isOn)}
+ onPress={() => this.props.onToggle(!this.props.isOn)}
>
diff --git a/src/components/TextInputFocusable/index.ios.js b/src/components/TextInputFocusable/index.ios.js
index 42b5fff111af..8d6aecc4b056 100644
--- a/src/components/TextInputFocusable/index.ios.js
+++ b/src/components/TextInputFocusable/index.ios.js
@@ -73,7 +73,7 @@ class TextInputFocusable extends React.Component {
render() {
// Selection Property not worked in IOS properly, So removed from props.
- const {selection, ...newProps} = this.props;
+ const propsToPass = _.omit(this.props, 'selection');
return (
);
}
diff --git a/src/components/UnorderedList.js b/src/components/UnorderedList.js
index 9c2ee04fc8f6..a0efcf3ed069 100644
--- a/src/components/UnorderedList.js
+++ b/src/components/UnorderedList.js
@@ -13,9 +13,9 @@ const defaultProps = {
items: [],
};
-const UnorderedList = ({items}) => (
+const UnorderedList = props => (
<>
- {_.map(items, itemText => (
+ {_.map(props.items, itemText => (
{
return Str.removeSMSDomain(details.login);
};
-const DetailsPage = ({
- personalDetails, route, translate, toLocalPhone,
-}) => {
- const details = personalDetails[route.params.login];
+const DetailsPage = (props) => {
+ const details = props.personalDetails[props.route.params.login];
const isSMSLogin = Str.isSMSLogin(details.login);
// If we have a reportID param this means that we
// arrived here via the ParticipantsPage and should be allowed to navigate back to it
- const shouldShowBackButton = Boolean(route.params.reportID);
+ const shouldShowBackButton = Boolean(props.route.params.reportID);
const timezone = moment().tz(details.timezone.selected);
const GMTTime = `${timezone.toString().split(/[+-]/)[0].slice(-3)} ${timezone.zoneAbbr()}`;
const currentTime = Number.isNaN(Number(timezone.zoneAbbr())) ? timezone.zoneAbbr() : GMTTime;
@@ -77,13 +75,13 @@ const DetailsPage = ({
if (pronouns && pronouns.startsWith(CONST.PRONOUNS.PREFIX)) {
const localeKey = pronouns.replace(CONST.PRONOUNS.PREFIX, '');
- pronouns = translate(`pronouns.${localeKey}`);
+ pronouns = props.translate(`pronouns.${localeKey}`);
}
return (
Navigation.goBack()}
onCloseButtonPress={() => Navigation.dismissModal()}
@@ -104,13 +102,13 @@ const DetailsPage = ({
/>
{details.displayName && (
- {isSMSLogin ? toLocalPhone(details.displayName) : details.displayName}
+ {isSMSLogin ? props.toLocalPhone(details.displayName) : details.displayName}
)}
{details.login ? (
- {translate(isSMSLogin
+ {props.translate(isSMSLogin
? 'common.phoneNumber'
: 'common.email')}
@@ -121,7 +119,7 @@ const DetailsPage = ({
{isSMSLogin
- ? toLocalPhone(getPhoneNumber(details))
+ ? props.toLocalPhone(getPhoneNumber(details))
: details.login}
@@ -131,7 +129,7 @@ const DetailsPage = ({
{pronouns ? (
- {translate('profilePage.preferredPronouns')}
+ {props.translate('profilePage.preferredPronouns')}
{pronouns}
@@ -141,7 +139,7 @@ const DetailsPage = ({
{shouldShowLocalTime && details.timezone ? (
- {translate('detailsPage.localTime')}
+ {props.translate('detailsPage.localTime')}
{timezone.format('LT')}
diff --git a/src/pages/NotFound.js b/src/pages/NotFound.js
new file mode 100755
index 000000000000..e69de29bb2d1
diff --git a/src/pages/ReimbursementAccount/EnableStep.js b/src/pages/ReimbursementAccount/EnableStep.js
index 140376d385f9..d3e1366b7b2c 100644
--- a/src/pages/ReimbursementAccount/EnableStep.js
+++ b/src/pages/ReimbursementAccount/EnableStep.js
@@ -44,17 +44,14 @@ class EnableStep extends React.Component {
}
render() {
- const {
- user, reimbursementAccount, translate, bankAccountList,
- } = this.props;
- if (this.props.isLoadingPaymentMethods || _.isEmpty(bankAccountList)) {
+ if (this.props.isLoadingPaymentMethods || _.isEmpty(this.props.bankAccountList)) {
return (
);
}
- const isUsingExpensifyCard = user.isUsingExpensifyCard;
- const account = _.find(bankAccountList, bankAccount => bankAccount.bankAccountID === reimbursementAccount.achData.bankAccountID);
+ const isUsingExpensifyCard = this.props.user.isUsingExpensifyCard;
+ const account = _.find(this.props.bankAccountList, bankAccount => bankAccount.bankAccountID === this.props.reimbursementAccount.achData.bankAccountID);
if (!account) {
// This shouldn't happen as we can only end up here if we have successfully added a bank account.
// But in case it does we'll throw here directly so it can be caught by the error boundary.
@@ -63,7 +60,7 @@ class EnableStep extends React.Component {
const {icon, iconSize} = getBankIcon(account.additionalData.bankName);
const formattedBankAccountNumber = account.accountNumber
- ? `${translate('paymentMethodList.accountLastFour')} ${
+ ? `${this.props.translate('paymentMethodList.accountLastFour')} ${
account.accountNumber.slice(-4)
}`
: '';
@@ -75,7 +72,7 @@ class EnableStep extends React.Component {
}];
if (!isUsingExpensifyCard) {
menuItems.unshift({
- title: translate('workspace.bankAccount.chatWithConcierge'),
+ title: this.props.translate('workspace.bankAccount.chatWithConcierge'),
icon: ChatBubble,
onPress: () => {
navigateToConciergeChat();
@@ -87,14 +84,14 @@ class EnableStep extends React.Component {
return (
Navigation.goBack()}
/>
(!isUsingExpensifyCard ? : )}
menuItems={menuItems}
>
@@ -110,8 +107,8 @@ class EnableStep extends React.Component {
/>
{!isUsingExpensifyCard
- ? translate('workspace.bankAccount.accountDescriptionNoCards')
- : translate('workspace.bankAccount.accountDescriptionWithCards')}
+ ? this.props.translate('workspace.bankAccount.accountDescriptionNoCards')
+ : this.props.translate('workspace.bankAccount.accountDescriptionWithCards')}
diff --git a/src/pages/ReimbursementAccount/IdentityForm.js b/src/pages/ReimbursementAccount/IdentityForm.js
index b21eb60d09dc..683de6a3f350 100644
--- a/src/pages/ReimbursementAccount/IdentityForm.js
+++ b/src/pages/ReimbursementAccount/IdentityForm.js
@@ -72,129 +72,122 @@ const defaultProps = {
};
-const IdentityForm = ({
- translate, values, onFieldChange, style, errors,
-}) => {
- const {
- firstName, lastName, street, city, state, zipCode, dob, ssnLast4, manualAddress,
- } = values;
-
+const IdentityForm = (props) => {
// dob field has multiple validations/errors, we are handling it temporarily like this.
- const dobErrorText = (errors.dob ? translate('bankAccount.error.dob') : '')
- || (errors.dobAge ? translate('bankAccount.error.age') : '');
+ const dobErrorText = (props.errors.dob ? props.translate('bankAccount.error.dob') : '')
+ || (props.errors.dobAge ? props.translate('bankAccount.error.age') : '');
const getFormattedAddressValue = () => {
let addressString = '';
- if (street) {
- addressString += `${street}, `;
+ if (props.values.street) {
+ addressString += `${props.values.street}, `;
}
- if (city) {
- addressString += `${city}, `;
+ if (props.values.city) {
+ addressString += `${props.values.city}, `;
}
- if (state) {
- addressString += `${state}, `;
+ if (props.values.state) {
+ addressString += `${props.values.state}, `;
}
- if (zipCode) {
- addressString += `${zipCode}`;
+ if (props.values.zipCode) {
+ addressString += `${props.values.zipCode}`;
}
return addressString;
};
return (
-
+
onFieldChange('firstName', value)}
- errorText={errors.firstName ? translate('bankAccount.error.firstName') : ''}
+ label={`${props.translate('common.firstName')}`}
+ value={props.values.firstName}
+ onChangeText={value => props.onFieldChange('firstName', value)}
+ errorText={props.errors.firstName ? props.translate('bankAccount.error.firstName') : ''}
translateX={-10}
/>
onFieldChange('lastName', value)}
- errorText={errors.lastName ? translate('bankAccount.error.lastName') : ''}
+ label={`${props.translate('common.lastName')}`}
+ value={props.values.lastName}
+ onChangeText={value => props.onFieldChange('lastName', value)}
+ errorText={props.errors.lastName ? props.translate('bankAccount.error.lastName') : ''}
translateX={-10}
/>
onFieldChange('dob', value)}
+ placeholder={props.translate('common.dateFormat')}
+ value={props.values.dob}
+ onChange={value => props.onFieldChange('dob', value)}
errorText={dobErrorText}
/>
onFieldChange('ssnLast4', value)}
- errorText={errors.ssnLast4 ? translate('bankAccount.error.ssnLast4') : ''}
+ value={props.values.ssnLast4}
+ onChangeText={value => props.onFieldChange('ssnLast4', value)}
+ errorText={props.errors.ssnLast4 ? props.translate('bankAccount.error.ssnLast4') : ''}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.SSN}
/>
- {!manualAddress && (
-
-
onFieldChange(fieldName, value)}
- errorText={errors.street ? translate('bankAccount.error.addressStreet') : ''}
- />
- onFieldChange('manualAddress', true)}
- >
- Can't find your address? Enter it manually
-
-
- )}
- {manualAddress && (
-
+ {props.manualAddress ? (
+ <>
onFieldChange('addressStreet', value)}
- errorText={errors.street ? translate('bankAccount.error.address') : ''}
+ value={props.street}
+ onChangeText={value => props.onFieldChange('addressStreet', value)}
+ errorText={props.errors.street ? props.translate('bankAccount.error.address') : ''}
/>
- {translate('common.noPO')}
+ {props.translate('common.noPO')}
onFieldChange('addressCity', value)}
- errorText={errors.city ? translate('bankAccount.error.addressCity') : ''}
+ label={props.translate('common.city')}
+ value={props.city}
+ onChangeText={value => props.onFieldChange('addressCity', value)}
+ errorText={props.errors.city ? props.translate('bankAccount.error.addressCity') : ''}
translateX={-14}
/>
onFieldChange('addressState', value)}
- errorText={errors.state ? translate('bankAccount.error.addressState') : ''}
- hasError={Boolean(errors.state)}
+ value={props.state}
+ onChange={value => props.onFieldChange('addressState', value)}
+ errorText={props.errors.state ? props.translate('bankAccount.error.addressState') : ''}
+ hasError={Boolean(props.errors.state)}
/>
onFieldChange('addressZipCode', value)}
- errorText={errors.zipCode ? translate('bankAccount.error.zipCode') : ''}
+ value={props.zipCode}
+ onChangeText={value => props.onFieldChange('addressZipCode', value)}
+ errorText={props.errors.zipCode ? props.translate('bankAccount.error.zipCode') : ''}
maxLength={CONST.BANK_ACCOUNT.MAX_LENGTH.ZIP_CODE}
/>
-
+ >
+ ) : (
+ <>
+ props.onFieldChange(fieldName, value)}
+ errorText={props.errors.street ? props.translate('bankAccount.error.addressStreet') : ''}
+ />
+ props.onFieldChange('manualAddress', true)}
+ >
+ Can't find your address? Enter it manually
+
+ >
)}
);
diff --git a/src/pages/ReportParticipantsPage.js b/src/pages/ReportParticipantsPage.js
index aef51d56be3f..ad97e6a150f9 100755
--- a/src/pages/ReportParticipantsPage.js
+++ b/src/pages/ReportParticipantsPage.js
@@ -74,21 +74,16 @@ const getAllParticipants = (report, personalDetails) => {
});
};
-const ReportParticipantsPage = ({
- personalDetails,
- report,
- route,
- translate,
-}) => {
- const participants = getAllParticipants(report, personalDetails);
+const ReportParticipantsPage = (props) => {
+ const participants = getAllParticipants(props.report, props.personalDetails);
return (
{
Navigation.navigate(ROUTES.getReportParticipantRoute(
- route.params.reportID, option.login,
+ props.route.params.reportID, option.login,
));
}}
hideSectionHeaders
diff --git a/src/pages/home/report/ReportActionCompose.js b/src/pages/home/report/ReportActionCompose.js
index d421e8650cce..9803092e52cd 100755
--- a/src/pages/home/report/ReportActionCompose.js
+++ b/src/pages/home/report/ReportActionCompose.js
@@ -425,17 +425,17 @@ class ReportActionCompose extends React.Component {
*/
addEmojiToTextBox(emoji) {
this.hideEmojiPicker();
- const {selection} = this.state;
- const newComment = this.comment.slice(0, selection.start)
- + emoji + this.comment.slice(selection.end, this.comment.length);
+ const newComment = this.comment.slice(0, this.state.selection.start)
+ + emoji + this.comment.slice(this.state.selection.end, this.comment.length);
this.textInput.setNativeProps({
text: newComment,
});
- const updatedSelection = {
- start: selection.start + emoji.length,
- end: selection.start + emoji.length,
- };
- this.setState({selection: updatedSelection});
+ this.setState(prevState => ({
+ selection: {
+ start: prevState.selection.start + emoji.length,
+ end: prevState.selection.start + emoji.length,
+ },
+ }));
this.updateComment(newComment);
}
diff --git a/src/pages/home/report/ReportActionItem.js b/src/pages/home/report/ReportActionItem.js
index 2d1050f87cee..92dd9d1564a0 100644
--- a/src/pages/home/report/ReportActionItem.js
+++ b/src/pages/home/report/ReportActionItem.js
@@ -201,8 +201,7 @@ export default compose(
withReportActionsDrafts({
propName: 'draftMessage',
transformValue: (drafts, props) => {
- const {reportID, action} = props;
- const draftKey = `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${reportID}_${action.reportActionID}`;
+ const draftKey = `${ONYXKEYS.COLLECTION.REPORT_ACTIONS_DRAFTS}${props.reportID}_${props.action.reportActionID}`;
return lodashGet(drafts, draftKey, '');
},
}),
diff --git a/src/pages/home/report/ReportActionItemFragment.js b/src/pages/home/report/ReportActionItemFragment.js
index 69b4aac3b8b5..1d7eeb401311 100644
--- a/src/pages/home/report/ReportActionItemFragment.js
+++ b/src/pages/home/report/ReportActionItemFragment.js
@@ -46,8 +46,7 @@ const defaultProps = {
class ReportActionItemFragment extends React.PureComponent {
render() {
- const {fragment, tooltipText} = this.props;
- switch (fragment.type) {
+ switch (this.props.fragment.type) {
case 'COMMENT':
// If this is an attachment placeholder, return the placeholder component
if (this.props.isAttachment && this.props.loading) {
@@ -63,38 +62,38 @@ class ReportActionItemFragment extends React.PureComponent {
}
// Only render HTML if we have html in the fragment
- return fragment.html !== fragment.text
+ return this.props.fragment.html !== this.props.fragment.text
? (
${fragment.html + (fragment.isEdited ? ' ' : '')}`}
+ html={`${this.props.fragment.html + (this.props.fragment.isEdited ? ' ' : '')} `}
/>
) : (
- {Str.htmlDecode(fragment.text)}
- {fragment.isEdited && (
-
- {/* Native devices do not support margin between nested text */}
- {' '}
- {this.props.translate('reportActionCompose.edited')}
-
+ {Str.htmlDecode(this.props.fragment.text)}
+ {this.props.fragment.isEdited && (
+
+ {/* Native devices do not support margin between nested text */}
+ {' '}
+ {this.props.translate('reportActionCompose.edited')}
+
)}
);
case 'TEXT':
return (
-
+
- {Str.htmlDecode(fragment.text)}
+ {Str.htmlDecode(this.props.fragment.text)}
);
diff --git a/src/pages/home/report/ReportActionItemGrouped.js b/src/pages/home/report/ReportActionItemGrouped.js
index be6dde41bbf6..e811144ccaad 100644
--- a/src/pages/home/report/ReportActionItemGrouped.js
+++ b/src/pages/home/report/ReportActionItemGrouped.js
@@ -8,10 +8,10 @@ const propTypes = {
children: PropTypes.node.isRequired,
};
-const ReportActionItemGrouped = ({children}) => (
+const ReportActionItemGrouped = props => (
- {children}
+ {props.children}
);
diff --git a/src/pages/home/report/ReportActionItemMessage.js b/src/pages/home/report/ReportActionItemMessage.js
index d865671b7cce..96c42f2c2b2d 100644
--- a/src/pages/home/report/ReportActionItemMessage.js
+++ b/src/pages/home/report/ReportActionItemMessage.js
@@ -22,16 +22,16 @@ const defaultProps = {
network: {isOffline: false},
};
-const ReportActionItemMessage = ({action, network}) => {
- const isUnsent = network.isOffline && action.loading;
+const ReportActionItemMessage = (props) => {
+ const isUnsent = props.network.isOffline && props.action.loading;
return (
- {_.map(_.compact(action.message), (fragment, index) => (
+ {_.map(_.compact(props.action.message), (fragment, index) => (
))}
diff --git a/src/pages/home/report/ReportActionItemSingle.js b/src/pages/home/report/ReportActionItemSingle.js
index 525317829d5c..f51ae26bc9e9 100644
--- a/src/pages/home/report/ReportActionItemSingle.js
+++ b/src/pages/home/report/ReportActionItemSingle.js
@@ -41,30 +41,24 @@ const showUserDetails = (email) => {
Navigation.navigate(ROUTES.getDetailsRoute(email));
};
-const ReportActionItemSingle = ({
- action,
- personalDetails,
- children,
- wrapperStyles,
- toLocalPhone,
-}) => {
- const {avatar, displayName, login} = personalDetails[action.actorEmail] || {};
- const avatarUrl = action.automatic
+const ReportActionItemSingle = (props) => {
+ const {avatar, displayName, login} = props.personalDetails[props.action.actorEmail] || {};
+ const avatarUrl = props.action.automatic
? `${CONST.CLOUDFRONT_URL}/images/icons/concierge_2019.svg`
// Use avatar in personalDetails if we have one then fallback to avatar provided by the action
- : (avatar || action.avatar);
+ : (avatar || props.action.avatar);
// Since the display name for a report action message is delivered with the report history as an array of fragments
// we'll need to take the displayName from personal details and have it be in the same format for now. Eventually,
// we should stop referring to the report history items entirely for this information.
const personArray = displayName
- ? [{type: 'TEXT', text: Str.isSMSLogin(login) ? toLocalPhone(displayName) : displayName}]
- : action.person;
+ ? [{type: 'TEXT', text: Str.isSMSLogin(login) ? props.toLocalPhone(displayName) : displayName}]
+ : props.action.person;
return (
-
- showUserDetails(action.actorEmail)}>
+
+ showUserDetails(props.action.actorEmail)}>
- showUserDetails(action.actorEmail)}>
+ showUserDetails(props.action.actorEmail)}>
{_.map(personArray, (fragment, index) => (
))}
-
+
- {children}
+ {props.children}
);
diff --git a/src/pages/home/sidebar/OptionRow.js b/src/pages/home/sidebar/OptionRow.js
index ed51211b9691..ecd68cbc3ddd 100644
--- a/src/pages/home/sidebar/OptionRow.js
+++ b/src/pages/home/sidebar/OptionRow.js
@@ -80,37 +80,22 @@ const defaultProps = {
disableRowInteractivity: false,
};
-const OptionRow = ({
- backgroundColor,
- hoverStyle,
- option,
- optionIsFocused,
- onSelectRow,
- hideAdditionalOptionStates,
- showSelectedState,
- isSelected,
- forceTextUnreadStyle,
- showTitleTooltip,
- isDisabled,
- mode,
- disableRowInteractivity,
- toLocalPhone,
-}) => {
- const textStyle = optionIsFocused
+const OptionRow = (props) => {
+ const textStyle = props.optionIsFocused
? styles.sidebarLinkActiveText
: styles.sidebarLinkText;
- const textUnreadStyle = (option.isUnread || forceTextUnreadStyle)
+ const textUnreadStyle = (props.option.isUnread || props.forceTextUnreadStyle)
? [textStyle, styles.sidebarLinkTextUnread] : [textStyle];
- const displayNameStyle = mode === 'compact'
+ const displayNameStyle = props.mode === 'compact'
? [styles.optionDisplayName, ...textUnreadStyle, styles.optionDisplayNameCompact, styles.mr2]
: [styles.optionDisplayName, ...textUnreadStyle];
- const alternateTextStyle = mode === 'compact'
+ const alternateTextStyle = props.mode === 'compact'
? [textStyle, styles.optionAlternateText, styles.textLabelSupporting, styles.optionAlternateTextCompact]
: [textStyle, styles.optionAlternateText, styles.textLabelSupporting, styles.mt1];
- const contentContainerStyles = mode === 'compact'
+ const contentContainerStyles = props.mode === 'compact'
? [styles.flex1, styles.flexRow, styles.overflowHidden, styles.alignItemsCenter]
: [styles.flex1];
- const sidebarInnerRowStyle = StyleSheet.flatten(mode === 'compact' ? [
+ const sidebarInnerRowStyle = StyleSheet.flatten(props.mode === 'compact' ? [
styles.chatLinkRowPressable,
styles.flexGrow1,
styles.optionItemAvatarNameWrapper,
@@ -123,18 +108,18 @@ const OptionRow = ({
styles.sidebarInnerRow,
styles.justifyContentCenter,
]);
- const hoveredBackgroundColor = hoverStyle && hoverStyle.backgroundColor
- ? hoverStyle.backgroundColor
- : backgroundColor;
+ const hoveredBackgroundColor = props.hoverStyle && props.hoverStyle.backgroundColor
+ ? props.hoverStyle.backgroundColor
+ : props.backgroundColor;
const focusedBackgroundColor = styles.sidebarLinkActive.backgroundColor;
- const isMultipleParticipant = lodashGet(option, 'participantsList.length', 0) > 1;
+ const isMultipleParticipant = lodashGet(props.option, 'participantsList.length', 0) > 1;
const displayNamesWithTooltips = _.map(
// We only create tooltips for the first 10 users or so since some reports have hundreds of users causing
// performance to degrade.
- (option.participantsList || []).slice(0, 10),
+ (props.option.participantsList || []).slice(0, 10),
({displayName, firstName, login}) => {
- const displayNameTrimmed = Str.isSMSLogin(login) ? toLocalPhone(displayName) : displayName;
+ const displayNameTrimmed = Str.isSMSLogin(login) ? props.toLocalPhone(displayName) : displayName;
return {
displayName: (isMultipleParticipant ? firstName : displayNameTrimmed) || Str.removeSMSDomain(login),
@@ -146,8 +131,8 @@ const OptionRow = ({
{hovered => (
onSelectRow(option)}
- disabled={disableRowInteractivity}
+ onPress={() => props.onSelectRow(props.option)}
+ disabled={props.disableRowInteractivity}
activeOpacity={0.8}
style={[
styles.flexRow,
@@ -155,10 +140,10 @@ const OptionRow = ({
styles.justifyContentBetween,
styles.sidebarLink,
styles.sidebarLinkInner,
- getBackgroundColorStyle(backgroundColor),
- optionIsFocused ? styles.sidebarLinkActive : null,
- hovered && !optionIsFocused ? hoverStyle : null,
- isDisabled && styles.cursorDisabled,
+ getBackgroundColorStyle(props.backgroundColor),
+ props.optionIsFocused ? styles.sidebarLinkActive : null,
+ hovered && !props.optionIsFocused ? props.hoverStyle : null,
+ props.isDisabled && styles.cursorDisabled,
]}
>
@@ -169,70 +154,70 @@ const OptionRow = ({
]}
>
{
- !_.isEmpty(option.icons)
+ !_.isEmpty(props.option.icons)
&& (
)
}
- {option.alternateText ? (
+ {props.option.alternateText ? (
- {option.alternateText}
+ {props.option.alternateText}
) : null}
- {option.descriptiveText ? (
+ {props.option.descriptiveText ? (
- {option.descriptiveText}
+ {props.option.descriptiveText}
) : null}
- {showSelectedState && (
+ {props.showSelectedState && (
- {isSelected && (
+ {props.isSelected && (
)}
)}
- {!hideAdditionalOptionStates && (
+ {!props.hideAdditionalOptionStates && (
- {option.hasDraftComment && (
+ {props.option.hasDraftComment && (
)}
- {option.hasOutstandingIOU && (
-
+ {props.option.hasOutstandingIOU && (
+
)}
- {option.isPinned && (
+ {props.option.isPinned && (
diff --git a/src/pages/settings/AboutPage.js b/src/pages/settings/AboutPage.js
index 785a5c72535c..3d2d7207e547 100644
--- a/src/pages/settings/AboutPage.js
+++ b/src/pages/settings/AboutPage.js
@@ -26,7 +26,7 @@ const propTypes = {
...withLocalizePropTypes,
};
-const AboutPage = ({translate}) => {
+const AboutPage = (props) => {
const menuItems = [
{
translationKey: 'initialSettingsPage.aboutPage.appDownloadLinks',
@@ -61,7 +61,7 @@ const AboutPage = ({translate}) => {
return (
Navigation.navigate(ROUTES.SETTINGS)}
onCloseButtonPress={() => Navigation.dismissModal(true)}
@@ -90,14 +90,14 @@ const AboutPage = ({translate}) => {
{version}
- {translate('initialSettingsPage.aboutPage.description')}
+ {props.translate('initialSettingsPage.aboutPage.description')}
{_.map(menuItems, item => (
item.action()}
@@ -110,7 +110,7 @@ const AboutPage = ({translate}) => {
style={[styles.chatItemMessageHeaderTimestamp]}
numberOfLines={1}
>
- {translate(
+ {props.translate(
'initialSettingsPage.readTheTermsAndPrivacyPolicy.phrase1',
)}
{' '}
@@ -118,12 +118,12 @@ const AboutPage = ({translate}) => {
style={[styles.chatItemMessageHeaderTimestamp, styles.link]}
onPress={() => openExternalLink(CONST.TERMS_URL)}
>
- {translate(
+ {props.translate(
'initialSettingsPage.readTheTermsAndPrivacyPolicy.phrase2',
)}
{' '}
- {translate(
+ {props.translate(
'initialSettingsPage.readTheTermsAndPrivacyPolicy.phrase3',
)}
{' '}
@@ -131,7 +131,7 @@ const AboutPage = ({translate}) => {
style={[styles.chatItemMessageHeaderTimestamp, styles.link]}
onPress={() => openExternalLink(CONST.PRIVACY_URL)}
>
- {translate(
+ {props.translate(
'initialSettingsPage.readTheTermsAndPrivacyPolicy.phrase4',
)}
diff --git a/src/pages/settings/AppDownloadLinks.js b/src/pages/settings/AppDownloadLinks.js
index 8502e31165f4..ee85fc33635a 100644
--- a/src/pages/settings/AppDownloadLinks.js
+++ b/src/pages/settings/AppDownloadLinks.js
@@ -17,7 +17,7 @@ const propTypes = {
...withLocalizePropTypes,
};
-const AppDownloadLinksPage = ({translate}) => {
+const AppDownloadLinksPage = (props) => {
const menuItems = [
{
translationKey: 'initialSettingsPage.appDownloadLinks.android.label',
@@ -42,7 +42,7 @@ const AppDownloadLinksPage = ({translate}) => {
return (
Navigation.goBack()}
onCloseButtonPress={() => Navigation.dismissModal(true)}
@@ -51,7 +51,7 @@ const AppDownloadLinksPage = ({translate}) => {
{_.map(menuItems, item => (
item.action()}
diff --git a/src/pages/settings/InitialSettingsPage.js b/src/pages/settings/InitialSettingsPage.js
index c3e06d701721..1ca415cc7e17 100755
--- a/src/pages/settings/InitialSettingsPage.js
+++ b/src/pages/settings/InitialSettingsPage.js
@@ -128,30 +128,21 @@ const defaultMenuItems = [
},
];
-const InitialSettingsPage = ({
- myPersonalDetails,
- network,
- numberFormat,
- session,
- policies,
- translate,
- userWallet,
- betas,
-}) => {
- const walletBalance = numberFormat(
- userWallet.currentBalance / 100, // Divide by 100 because balance is in cents
+const InitialSettingsPage = (props) => {
+ const walletBalance = props.numberFormat(
+ props.userWallet.currentBalance / 100, // Divide by 100 because balance is in cents
{style: 'currency', currency: 'USD'},
);
// On the very first sign in or after clearing storage these
// details will not be present on the first render so we'll just
// return nothing for now.
- if (_.isEmpty(myPersonalDetails)) {
+ if (_.isEmpty(props.myPersonalDetails)) {
return null;
}
// Add free policies (workspaces) to the list of menu items
- const menuItems = _.chain(policies)
+ const menuItems = _.chain(props.policies)
.filter(policy => policy && policy.type === CONST.POLICY.TYPE.FREE && policy.role === CONST.POLICY.ROLE.ADMIN)
.map(policy => ({
title: policy.name,
@@ -170,7 +161,7 @@ const InitialSettingsPage = ({
return (
Navigation.dismissModal(true)}
/>
@@ -179,30 +170,30 @@ const InitialSettingsPage = ({
- {myPersonalDetails.displayName
- ? myPersonalDetails.displayName
- : Str.removeSMSDomain(session.email)}
+ {props.myPersonalDetails.displayName
+ ? props.myPersonalDetails.displayName
+ : Str.removeSMSDomain(props.session.email)}
- {myPersonalDetails.displayName && (
+ {props.myPersonalDetails.displayName && (
- {Str.removeSMSDomain(session.email)}
+ {Str.removeSMSDomain(props.session.email)}
)}
{_.map(menuItems, (item, index) => {
- const keyTitle = item.translationKey ? translate(item.translationKey) : item.title;
+ const keyTitle = item.translationKey ? props.translate(item.translationKey) : item.title;
const isPaymentItem = item.translationKey === 'common.payments';
return (
);
})}
diff --git a/src/pages/settings/PreferencesPage.js b/src/pages/settings/PreferencesPage.js
index e1f2a1439026..c58ce69fbd47 100755
--- a/src/pages/settings/PreferencesPage.js
+++ b/src/pages/settings/PreferencesPage.js
@@ -42,26 +42,24 @@ const defaultProps = {
user: {},
};
-const PreferencesPage = ({
- priorityMode, user, translate, environment,
-}) => {
+const PreferencesPage = (props) => {
const priorityModes = {
default: {
value: CONST.PRIORITY_MODE.DEFAULT,
- label: translate('preferencesPage.mostRecent'),
- description: translate('preferencesPage.mostRecentModeDescription'),
+ label: props.translate('preferencesPage.mostRecent'),
+ description: props.translate('preferencesPage.mostRecentModeDescription'),
},
gsd: {
value: CONST.PRIORITY_MODE.GSD,
- label: translate('preferencesPage.focus'),
- description: translate('preferencesPage.focusModeDescription'),
+ label: props.translate('preferencesPage.focus'),
+ description: props.translate('preferencesPage.focusModeDescription'),
},
};
return (
Navigation.navigate(ROUTES.SETTINGS)}
onCloseButtonPress={() => Navigation.dismissModal(true)}
@@ -69,33 +67,33 @@ const PreferencesPage = ({
- {translate('common.notifications')}
+ {props.translate('common.notifications')}
- {translate('preferencesPage.receiveRelevantFeatureUpdatesAndExpensifyNews')}
+ {props.translate('preferencesPage.receiveRelevantFeatureUpdatesAndExpensifyNews')}
NameValuePair.set(CONST.NVP.PRIORITY_MODE, mode, ONYXKEYS.NVP_PRIORITY_MODE)
}
items={_.values(priorityModes)}
- value={priorityMode}
+ value={props.priorityMode}
/>
- {priorityModes[priorityMode].description}
+ {priorityModes[props.priorityMode].description}
@@ -103,7 +101,7 @@ const PreferencesPage = ({
{/* If we are in the staging environment then we have the option to switch from using the staging secure endpoint or the production secure endpoint. This enables QA */}
{/* and internal testers to take advantage of sandbox environments for 3rd party services like Plaid and Onfido */}
- {environment === CONST.ENVIRONMENT.STAGING && (
+ {props.environment === CONST.ENVIRONMENT.STAGING && (
<>
Test Preferences
@@ -116,7 +114,7 @@ const PreferencesPage = ({
diff --git a/src/pages/settings/Profile/ProfilePage.js b/src/pages/settings/Profile/ProfilePage.js
index e54ed48a68d7..77082817204e 100755
--- a/src/pages/settings/Profile/ProfilePage.js
+++ b/src/pages/settings/Profile/ProfilePage.js
@@ -73,22 +73,15 @@ const timezones = _.map(moment.tz.names(), timezone => ({
class ProfilePage extends Component {
constructor(props) {
super(props);
- const {
- firstName,
- lastName,
- pronouns,
- timezone = {},
- } = props.myPersonalDetails;
-
this.state = {
- firstName,
+ firstName: props.myPersonalDetails.firstName,
firstNameError: '',
- lastName,
+ lastName: props.myPersonalDetails.lastName,
lastNameError: '',
- pronouns,
- hasSelfSelectedPronouns: !_.isEmpty(pronouns) && !pronouns.startsWith(CONST.PRONOUNS.PREFIX),
- selectedTimezone: lodashGet(timezone, 'selected', CONST.DEFAULT_TIME_ZONE.selected),
- isAutomaticTimezone: lodashGet(timezone, 'automatic', CONST.DEFAULT_TIME_ZONE.automatic),
+ pronouns: props.myPersonalDetails.pronouns,
+ hasSelfSelectedPronouns: !_.isEmpty(props.myPersonalDetails.pronouns) && !props.myPersonalDetails.pronouns.startsWith(CONST.PRONOUNS.PREFIX),
+ selectedTimezone: lodashGet(props.myPersonalDetails.timezone, 'selected', CONST.DEFAULT_TIME_ZONE.selected),
+ isAutomaticTimezone: lodashGet(props.myPersonalDetails.timezone, 'automatic', CONST.DEFAULT_TIME_ZONE.automatic),
logins: this.getLogins(props.user.loginList),
};
this.getLogins = this.getLogins.bind(this);
@@ -155,25 +148,17 @@ class ProfilePage extends Component {
* Submit form to update personal details
*/
updatePersonalDetails() {
- const {
- firstName,
- lastName,
- pronouns,
- selectedTimezone,
- isAutomaticTimezone,
- } = this.state;
-
if (!this.validateInputs()) {
return;
}
setPersonalDetails({
- firstName: firstName.trim(),
- lastName: lastName.trim(),
- pronouns: pronouns.trim(),
+ firstName: this.state.firstName.trim(),
+ lastName: this.state.lastName.trim(),
+ pronouns: this.state.pronouns.trim(),
timezone: {
- automatic: isAutomaticTimezone,
- selected: selectedTimezone,
+ automatic: this.state.isAutomaticTimezone,
+ selected: this.state.selectedTimezone,
},
}, true);
}
diff --git a/src/pages/signin/ChangeExpensifyLoginLink.js b/src/pages/signin/ChangeExpensifyLoginLink.js
index a8d3d16be345..230255a51e8c 100755
--- a/src/pages/signin/ChangeExpensifyLoginLink.js
+++ b/src/pages/signin/ChangeExpensifyLoginLink.js
@@ -21,14 +21,14 @@ const propTypes = {
...withLocalizePropTypes,
};
-const ChangeExpensifyLoginLink = ({credentials, translate, toLocalPhone}) => (
+const ChangeExpensifyLoginLink = props => (
- {translate('common.not')}
+ {props.translate('common.not')}
- {Str.isSMSLogin(credentials.login)
- ? toLocalPhone(Str.removeSMSDomain(credentials.login))
- : Str.removeSMSDomain(credentials.login)}
+ {Str.isSMSLogin(props.credentials.login)
+ ? props.toLocalPhone(Str.removeSMSDomain(props.credentials.login))
+ : Str.removeSMSDomain(props.credentials.login)}
{'? '}
(
underlayColor={themeColors.componentBG}
>
- {translate('common.goBack')}
+ {props.translate('common.goBack')}
{'.'}
diff --git a/src/pages/signin/TermsAndLicenses.js b/src/pages/signin/TermsAndLicenses.js
index 8cfd5df12a7d..56909935af64 100644
--- a/src/pages/signin/TermsAndLicenses.js
+++ b/src/pages/signin/TermsAndLicenses.js
@@ -8,7 +8,7 @@ import withLocalize, {withLocalizePropTypes} from '../../components/withLocalize
import LogoWordmark from '../../../assets/images/expensify-wordmark.svg';
import LocalePicker from '../../components/LocalePicker';
-const TermsAndLicenses = ({translate}) => (
+const TermsAndLicenses = props => (
<>
(
]}
>
- {translate('termsOfUse.phrase1')}
+ {props.translate('termsOfUse.phrase1')}
{' '}
- {translate('termsOfUse.phrase2')}
+ {props.translate('termsOfUse.phrase2')}
{' '}
- {translate('termsOfUse.phrase3')}
+ {props.translate('termsOfUse.phrase3')}
{' '}
- {translate('termsOfUse.phrase4')}
+ {props.translate('termsOfUse.phrase4')}
.
- {translate('termsOfUse.phrase5')}
+ {props.translate('termsOfUse.phrase5')}
{' '}
- {translate('termsOfUse.phrase6')}
+ {props.translate('termsOfUse.phrase6')}
{' '}
- {translate('termsOfUse.phrase7')}
+ {props.translate('termsOfUse.phrase7')}
.
diff --git a/src/pages/workspace/WorkspaceInitialPage.js b/src/pages/workspace/WorkspaceInitialPage.js
index 3b68bf4eb88c..ad0740037640 100644
--- a/src/pages/workspace/WorkspaceInitialPage.js
+++ b/src/pages/workspace/WorkspaceInitialPage.js
@@ -42,10 +42,8 @@ const propTypes = {
const defaultProps = fullPolicyDefaultProps;
-const WorkspaceInitialPage = ({
- translate, isSmallScreenWidth, policy, isFocused,
-}) => {
- if (_.isEmpty(policy)) {
+const WorkspaceInitialPage = (props) => {
+ if (_.isEmpty(props.policy)) {
return ;
}
@@ -53,59 +51,59 @@ const WorkspaceInitialPage = ({
{
translationKey: 'workspace.common.settings',
icon: Gear,
- action: () => Navigation.navigate(ROUTES.getWorkspaceSettingsRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceSettingsRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceSettingsRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceSettingsRoute(props.policy.id)),
},
{
translationKey: 'workspace.common.card',
icon: ExpensifyCard,
- action: () => Navigation.navigate(ROUTES.getWorkspaceCardRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceCardRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceCardRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceCardRoute(props.policy.id)),
},
{
translationKey: 'workspace.common.reimburse',
icon: Receipt,
- action: () => Navigation.navigate(ROUTES.getWorkspaceReimburseRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceReimburseRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceReimburseRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceReimburseRoute(props.policy.id)),
},
{
translationKey: 'workspace.common.bills',
icon: Bill,
- action: () => Navigation.navigate(ROUTES.getWorkspaceBillsRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceBillsRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceBillsRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceBillsRoute(props.policy.id)),
},
{
translationKey: 'workspace.common.invoices',
icon: Invoice,
- action: () => Navigation.navigate(ROUTES.getWorkspaceInvoicesRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceInvoicesRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceInvoicesRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceInvoicesRoute(props.policy.id)),
},
{
translationKey: 'workspace.common.travel',
icon: Luggage,
- action: () => Navigation.navigate(ROUTES.getWorkspaceTravelRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceTravelRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceTravelRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceTravelRoute(props.policy.id)),
},
{
translationKey: 'workspace.common.members',
icon: Users,
- action: () => Navigation.navigate(ROUTES.getWorkspaceMembersRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceMembersRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceMembersRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceMembersRoute(props.policy.id)),
},
{
translationKey: 'workspace.common.bankAccount',
icon: Bank,
- action: () => Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(policy.id)),
- isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceBankAccountRoute(policy.id)),
+ action: () => Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(props.policy.id)),
+ isActive: Navigation.isActiveRoute(ROUTES.getWorkspaceBankAccountRoute(props.policy.id)),
},
];
- const openEditor = () => Navigation.navigate(ROUTES.getWorkspaceSettingsRoute(policy.id));
+ const openEditor = () => Navigation.navigate(ROUTES.getWorkspaceSettingsRoute(props.policy.id));
return (
Navigation.navigate(ROUTES.SETTINGS)}
onCloseButtonPress={() => Navigation.dismissModal()}
@@ -124,12 +122,12 @@ const WorkspaceInitialPage = ({
style={[styles.pRelative, styles.avatarLarge]}
onPress={openEditor}
>
- {policy.avatarURL
+ {props.policy.avatarURL
? (
)
: (
@@ -142,7 +140,7 @@ const WorkspaceInitialPage = ({
)}
- {policy.name && (
+ {!_.isEmpty(props.policy.name) && (
-
+
- {policy.name}
+ {props.policy.name}
@@ -168,11 +166,11 @@ const WorkspaceInitialPage = ({
{_.map(menuItems, (item) => {
- const shouldFocus = isSmallScreenWidth ? !isFocused && item.isActive : item.isActive;
+ const shouldFocus = props.isSmallScreenWidth ? !props.isFocused && item.isActive : item.isActive;
return (
item.action()}
diff --git a/src/pages/workspace/WorkspaceSection.js b/src/pages/workspace/WorkspaceSection.js
index 4511b517c9a9..1a7142bbc538 100644
--- a/src/pages/workspace/WorkspaceSection.js
+++ b/src/pages/workspace/WorkspaceSection.js
@@ -31,33 +31,30 @@ const defaultProps = {
IconComponent: null,
};
-const WorkspaceSection = ({
- menuItems,
- title,
- icon,
- children,
- IconComponent,
-}) => (
- <>
-
-
-
- {title}
+const WorkspaceSection = (props) => {
+ const IconComponent = props.IconComponent;
+ return (
+ <>
+
+
+
+ {props.title}
+
+
+ {props.icon && }
+ {IconComponent && }
+
-
- {icon && }
- {IconComponent && }
-
-
-
- {children}
+
+ {props.children}
+
-
- {menuItems && }
- >
-);
+ {props.menuItems && }
+ >
+ );
+};
WorkspaceSection.displayName = 'WorkspaceSection';
WorkspaceSection.propTypes = propTypes;
diff --git a/src/pages/workspace/WorkspaceSettingsPage.js b/src/pages/workspace/WorkspaceSettingsPage.js
index a07a81fca149..fc45def9c876 100644
--- a/src/pages/workspace/WorkspaceSettingsPage.js
+++ b/src/pages/workspace/WorkspaceSettingsPage.js
@@ -109,14 +109,12 @@ class WorkspaceSettingsPage extends React.Component {
}
render() {
- const {policy} = this.props;
-
if (!Permissions.canUseFreePlan(this.props.betas)) {
Log.info('Not showing workspace editor page because user is not on free plan beta');
return ;
}
- if (_.isEmpty(policy)) {
+ if (_.isEmpty(this.props.policy)) {
return ;
}
@@ -128,7 +126,7 @@ class WorkspaceSettingsPage extends React.Component {
(
(
diff --git a/src/pages/workspace/bills/WorkspaceBillsFirstSection.js b/src/pages/workspace/bills/WorkspaceBillsFirstSection.js
index 3b2cbdb47c5f..bd79ca1b7dc5 100644
--- a/src/pages/workspace/bills/WorkspaceBillsFirstSection.js
+++ b/src/pages/workspace/bills/WorkspaceBillsFirstSection.js
@@ -35,21 +35,16 @@ const propTypes = {
user: userPropTypes.isRequired,
};
-const WorkspaceBillsFirstSection = ({
- translate,
- policyID,
- session,
- user,
-}) => {
- const emailDomain = Str.extractEmailDomain(session.email);
+const WorkspaceBillsFirstSection = (props) => {
+ const emailDomain = Str.extractEmailDomain(props.session.email);
return (
openOldDotLink(`reports?policyID=${policyID}&from=all&type=bill&showStates=Open,Processing,Approved,Reimbursed,Archived&isAdvancedFilterMode=true`),
+ title: props.translate('workspace.bills.viewAllBills'),
+ onPress: () => openOldDotLink(`reports?policyID=${props.policyID}&from=all&type=bill&showStates=Open,Processing,Approved,Reimbursed,Archived&isAdvancedFilterMode=true`),
icon: Bill,
shouldShowRightIcon: true,
iconRight: NewWindow,
@@ -58,8 +53,8 @@ const WorkspaceBillsFirstSection = ({
>
- {translate('workspace.bills.askYourVendorsBeforeEmail')}
- {user.isFromPublicDomain ? (
+ {props.translate('workspace.bills.askYourVendorsBeforeEmail')}
+ {props.user.isFromPublicDomain ? (
openExternalLink('https://community.expensify.com/discussion/7500/how-to-pay-your-company-bills-in-expensify/')}
>
@@ -71,7 +66,7 @@ const WorkspaceBillsFirstSection = ({
textStyles={[styles.textBlue]}
/>
)}
- {translate('workspace.bills.askYourVendorsAfterEmail')}
+ {props.translate('workspace.bills.askYourVendorsAfterEmail')}
diff --git a/src/pages/workspace/bills/WorkspaceBillsNoVBAView.js b/src/pages/workspace/bills/WorkspaceBillsNoVBAView.js
index bc88c1a08517..8eb072d49412 100644
--- a/src/pages/workspace/bills/WorkspaceBillsNoVBAView.js
+++ b/src/pages/workspace/bills/WorkspaceBillsNoVBAView.js
@@ -21,17 +21,17 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceBillsNoVBAView = ({translate, policyID}) => (
+const WorkspaceBillsNoVBAView = props => (
<>
-
+
Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(policyID)),
+ title: props.translate('workspace.common.bankAccount'),
+ onPress: () => Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(props.policyID)),
icon: Bank,
shouldShowRightIcon: true,
iconRight: ArrowRight,
@@ -39,7 +39,7 @@ const WorkspaceBillsNoVBAView = ({translate, policyID}) => (
]}
>
- {translate('workspace.bills.unlockNoVBACopy')}
+ {props.translate('workspace.bills.unlockNoVBACopy')}
>
diff --git a/src/pages/workspace/bills/WorkspaceBillsPage.js b/src/pages/workspace/bills/WorkspaceBillsPage.js
index ec07dbcb7c65..83d48a78b14a 100644
--- a/src/pages/workspace/bills/WorkspaceBillsPage.js
+++ b/src/pages/workspace/bills/WorkspaceBillsPage.js
@@ -18,10 +18,10 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceBillsPage = ({translate, route}) => (
+const WorkspaceBillsPage = props => (
{(hasVBA, policyID) => (
<>
diff --git a/src/pages/workspace/bills/WorkspaceBillsVBAView.js b/src/pages/workspace/bills/WorkspaceBillsVBAView.js
index 243aa362cbcf..9f57ab9cded5 100644
--- a/src/pages/workspace/bills/WorkspaceBillsVBAView.js
+++ b/src/pages/workspace/bills/WorkspaceBillsVBAView.js
@@ -20,17 +20,17 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceBillsVBAView = ({translate, policyID}) => (
+const WorkspaceBillsVBAView = props => (
<>
-
+
openOldDotLink(`reports?policyID=${policyID}&from=all&type=bill&showStates=Processing,Approved&isAdvancedFilterMode=true`),
+ title: props.translate('workspace.common.bills'),
+ onPress: () => openOldDotLink(`reports?policyID=${props.policyID}&from=all&type=bill&showStates=Processing,Approved&isAdvancedFilterMode=true`),
icon: Bill,
shouldShowRightIcon: true,
iconRight: NewWindow,
@@ -38,7 +38,7 @@ const WorkspaceBillsVBAView = ({translate, policyID}) => (
]}
>
- {translate('workspace.bills.VBACopy')}
+ {props.translate('workspace.bills.VBACopy')}
>
diff --git a/src/pages/workspace/card/WorkspaceCardNoVBAView.js b/src/pages/workspace/card/WorkspaceCardNoVBAView.js
index 72ad96ca1357..ac024d430546 100644
--- a/src/pages/workspace/card/WorkspaceCardNoVBAView.js
+++ b/src/pages/workspace/card/WorkspaceCardNoVBAView.js
@@ -18,29 +18,29 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceCardNoVBAView = ({translate, policyID}) => (
+const WorkspaceCardNoVBAView = props => (
Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(policyID)),
+ title: props.translate('workspace.common.bankAccount'),
+ onPress: () => Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(props.policyID)),
icon: Bank,
shouldShowRightIcon: true,
},
]}
>
- {translate('workspace.card.noVBACopy')}
+ {props.translate('workspace.card.noVBACopy')}
diff --git a/src/pages/workspace/card/WorkspaceCardPage.js b/src/pages/workspace/card/WorkspaceCardPage.js
index 8b97933330b4..be49bc84d65d 100644
--- a/src/pages/workspace/card/WorkspaceCardPage.js
+++ b/src/pages/workspace/card/WorkspaceCardPage.js
@@ -19,10 +19,10 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceCardPage = ({translate, route}) => (
+const WorkspaceCardPage = props => (
{(hasVBA, policyID, isUsingECard) => (
<>
diff --git a/src/pages/workspace/card/WorkspaceCardVBANoECardView.js b/src/pages/workspace/card/WorkspaceCardVBANoECardView.js
index 9e66079b2285..a0b158532edb 100644
--- a/src/pages/workspace/card/WorkspaceCardVBANoECardView.js
+++ b/src/pages/workspace/card/WorkspaceCardVBANoECardView.js
@@ -14,13 +14,13 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceCardVBANoECardView = ({translate}) => (
+const WorkspaceCardVBANoECardView = props => (
{
Navigation.dismissModal();
navigateToConciergeChat();
@@ -31,20 +31,20 @@ const WorkspaceCardVBANoECardView = ({translate}) => (
]}
>
- {translate('workspace.card.VBANoECardCopy')}
+ {props.translate('workspace.card.VBANoECardCopy')}
- {translate('workspace.card.conciergeCanHelp')}
+ {props.translate('workspace.card.conciergeCanHelp')}
);
diff --git a/src/pages/workspace/card/WorkspaceCardVBAWithECardView.js b/src/pages/workspace/card/WorkspaceCardVBAWithECardView.js
index 84f6e604e2b7..cba95ca9c77f 100644
--- a/src/pages/workspace/card/WorkspaceCardVBAWithECardView.js
+++ b/src/pages/workspace/card/WorkspaceCardVBAWithECardView.js
@@ -17,20 +17,20 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceCardVBAWithECardView = ({translate}) => (
+const WorkspaceCardVBAWithECardView = props => (
openOldDotLink('domain_companycards'),
icon: ExpensifyCard,
shouldShowRightIcon: true,
iconRight: NewWindow,
},
{
- title: translate('workspace.common.reconcileCards'),
+ title: props.translate('workspace.common.reconcileCards'),
onPress: () => openOldDotLink('domain_companycards?param={"section":"cardReconciliation"}'),
icon: ReceiptSearch,
shouldShowRightIcon: true,
@@ -39,15 +39,15 @@ const WorkspaceCardVBAWithECardView = ({translate}) => (
]}
>
- {translate('workspace.card.VBAWithECardCopy')}
+ {props.translate('workspace.card.VBAWithECardCopy')}
diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.js b/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.js
index c37cd258da8a..3cd8cbd8344d 100644
--- a/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.js
+++ b/src/pages/workspace/invoices/WorkspaceInvoicesFirstSection.js
@@ -20,21 +20,21 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceInvoicesFirstSection = ({translate, policyID}) => (
+const WorkspaceInvoicesFirstSection = props => (
openOldDotLink('reports?param={"createInvoice":true}'),
icon: Send,
shouldShowRightIcon: true,
iconRight: NewWindow,
},
{
- title: translate('workspace.invoices.viewAllInvoices'),
- onPress: () => openOldDotLink(`reports?policyID=${policyID}&from=all&type=invoice&showStates=Open,Processing,Approved,Reimbursed,Archived&isAdvancedFilterMode=true`),
+ title: props.translate('workspace.invoices.viewAllInvoices'),
+ onPress: () => openOldDotLink(`reports?policyID=${props.policyID}&from=all&type=invoice&showStates=Open,Processing,Approved,Reimbursed,Archived&isAdvancedFilterMode=true`),
icon: Invoice,
shouldShowRightIcon: true,
iconRight: NewWindow,
@@ -43,7 +43,7 @@ const WorkspaceInvoicesFirstSection = ({translate, policyID}) => (
>
- {translate('workspace.invoices.invoiceFirstSectionCopy')}
+ {props.translate('workspace.invoices.invoiceFirstSectionCopy')}
diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.js b/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.js
index 8db86ce7160c..724b47e10a2d 100644
--- a/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.js
+++ b/src/pages/workspace/invoices/WorkspaceInvoicesNoVBAView.js
@@ -21,17 +21,17 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceInvoicesNoVBAView = ({translate, policyID}) => (
+const WorkspaceInvoicesNoVBAView = props => (
<>
-
+
Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(policyID)),
+ title: props.translate('workspace.common.bankAccount'),
+ onPress: () => Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(props.policyID)),
icon: Bank,
shouldShowRightIcon: true,
iconRight: ArrowRight,
@@ -39,7 +39,7 @@ const WorkspaceInvoicesNoVBAView = ({translate, policyID}) => (
]}
>
- {translate('workspace.invoices.unlockNoVBACopy')}
+ {props.translate('workspace.invoices.unlockNoVBACopy')}
>
diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesPage.js b/src/pages/workspace/invoices/WorkspaceInvoicesPage.js
index 47a4fea43b30..acc83fb8c0a5 100644
--- a/src/pages/workspace/invoices/WorkspaceInvoicesPage.js
+++ b/src/pages/workspace/invoices/WorkspaceInvoicesPage.js
@@ -18,10 +18,10 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceInvoicesPage = ({translate, route}) => (
+const WorkspaceInvoicesPage = props => (
{(hasVBA, policyID) => (
<>
diff --git a/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.js b/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.js
index 87674bed4c2b..37ee7f0770c3 100644
--- a/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.js
+++ b/src/pages/workspace/invoices/WorkspaceInvoicesVBAView.js
@@ -20,17 +20,17 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceInvoicesVBAView = ({translate, policyID}) => (
+const WorkspaceInvoicesVBAView = props => (
<>
-
+
openOldDotLink(`reports?policyID=${policyID}&from=all&type=invoice&showStates=Processing&isAdvancedFilterMode=true`),
+ title: props.translate('workspace.invoices.viewUnpaidInvoices'),
+ onPress: () => openOldDotLink(`reports?policyID=${props.policyID}&from=all&type=invoice&showStates=Processing&isAdvancedFilterMode=true`),
icon: CircleHourglass,
shouldShowRightIcon: true,
iconRight: NewWindow,
@@ -38,7 +38,7 @@ const WorkspaceInvoicesVBAView = ({translate, policyID}) => (
]}
>
- {translate('workspace.invoices.unlockVBACopy')}
+ {props.translate('workspace.invoices.unlockVBACopy')}
>
diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseNoVBAView.js b/src/pages/workspace/reimburse/WorkspaceReimburseNoVBAView.js
index 19d65bf5f46e..ed4e4184ede4 100644
--- a/src/pages/workspace/reimburse/WorkspaceReimburseNoVBAView.js
+++ b/src/pages/workspace/reimburse/WorkspaceReimburseNoVBAView.js
@@ -23,15 +23,15 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceReimburseNoVBAView = ({translate, policyID}) => (
+const WorkspaceReimburseNoVBAView = props => (
<>
openOldDotLink(`expenses?policyIDList=${policyID}&billableReimbursable=reimbursable&submitterEmail=%2B%2B`),
+ title: props.translate('workspace.reimburse.viewAllReceipts'),
+ onPress: () => openOldDotLink(`expenses?policyIDList=${props.policyID}&billableReimbursable=reimbursable&submitterEmail=%2B%2B`),
icon: Receipt,
shouldShowRightIcon: true,
iconRight: NewWindow,
@@ -40,30 +40,30 @@ const WorkspaceReimburseNoVBAView = ({translate, policyID}) => (
>
- {translate('workspace.reimburse.captureNoVBACopyBeforeEmail')}
+ {props.translate('workspace.reimburse.captureNoVBACopyBeforeEmail')}
- {translate('workspace.reimburse.captureNoVBACopyAfterEmail')}
+ {props.translate('workspace.reimburse.captureNoVBACopyAfterEmail')}
Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(policyID)),
+ title: props.translate('workspace.common.bankAccount'),
+ onPress: () => Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(props.policyID)),
icon: Bank,
shouldShowRightIcon: true,
},
]}
>
- {translate('workspace.reimburse.unlockNoVBACopy')}
+ {props.translate('workspace.reimburse.unlockNoVBACopy')}
>
diff --git a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js
index ed2f79d1f766..107c5e9f8226 100644
--- a/src/pages/workspace/reimburse/WorkspaceReimbursePage.js
+++ b/src/pages/workspace/reimburse/WorkspaceReimbursePage.js
@@ -18,10 +18,10 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceReimbursePage = ({translate, route}) => (
+const WorkspaceReimbursePage = props => (
{(hasVBA, policyID) => (
<>
diff --git a/src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js b/src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js
index 72f88e132397..7e70f0ae8721 100644
--- a/src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js
+++ b/src/pages/workspace/reimburse/WorkspaceReimburseVBAView.js
@@ -21,15 +21,15 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceReimburseVBAView = ({translate, policyID}) => (
+const WorkspaceReimburseVBAView = props => (
<>
openOldDotLink(`expenses?policyIDList=${policyID}&billableReimbursable=reimbursable&submitterEmail=%2B%2B`),
+ title: props.translate('workspace.reimburse.viewAllReceipts'),
+ onPress: () => openOldDotLink(`expenses?policyIDList=${props.policyID}&billableReimbursable=reimbursable&submitterEmail=%2B%2B`),
icon: Receipt,
shouldShowRightIcon: true,
iconRight: NewWindow,
@@ -38,23 +38,23 @@ const WorkspaceReimburseVBAView = ({translate, policyID}) => (
>
- {translate('workspace.reimburse.captureNoVBACopyBeforeEmail')}
+ {props.translate('workspace.reimburse.captureNoVBACopyBeforeEmail')}
- {translate('workspace.reimburse.captureNoVBACopyAfterEmail')}
+ {props.translate('workspace.reimburse.captureNoVBACopyAfterEmail')}
openOldDotLink(`reports?policyID=${policyID}&from=all&type=expense&showStates=Archived&isAdvancedFilterMode=true`),
+ title: props.translate('workspace.reimburse.reimburseReceipts'),
+ onPress: () => openOldDotLink(`reports?policyID=${props.policyID}&from=all&type=expense&showStates=Archived&isAdvancedFilterMode=true`),
icon: Bank,
shouldShowRightIcon: true,
iconRight: NewWindow,
@@ -62,7 +62,7 @@ const WorkspaceReimburseVBAView = ({translate, policyID}) => (
]}
>
- {translate('workspace.reimburse.fastReimbursementsVBACopy')}
+ {props.translate('workspace.reimburse.fastReimbursementsVBACopy')}
>
diff --git a/src/pages/workspace/travel/WorkspaceTravelNoVBAView.js b/src/pages/workspace/travel/WorkspaceTravelNoVBAView.js
index 9a251fd79cc6..f193a6fc7b2a 100644
--- a/src/pages/workspace/travel/WorkspaceTravelNoVBAView.js
+++ b/src/pages/workspace/travel/WorkspaceTravelNoVBAView.js
@@ -20,15 +20,15 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceTravelNoVBAView = ({translate, policyID}) => (
+const WorkspaceTravelNoVBAView = props => (
<>
Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(policyID)),
+ title: props.translate('workspace.common.bankAccount'),
+ onPress: () => Navigation.navigate(ROUTES.getWorkspaceBankAccountRoute(props.policyID)),
icon: Bank,
shouldShowRightIcon: true,
iconRight: ArrowRight,
@@ -36,7 +36,7 @@ const WorkspaceTravelNoVBAView = ({translate, policyID}) => (
]}
>
- {translate('workspace.travel.noVBACopy')}
+ {props.translate('workspace.travel.noVBACopy')}
>
diff --git a/src/pages/workspace/travel/WorkspaceTravelPage.js b/src/pages/workspace/travel/WorkspaceTravelPage.js
index 3e23c251f4fb..eda053e40ca6 100644
--- a/src/pages/workspace/travel/WorkspaceTravelPage.js
+++ b/src/pages/workspace/travel/WorkspaceTravelPage.js
@@ -18,10 +18,10 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceTravelPage = ({translate, route}) => (
+const WorkspaceTravelPage = props => (
{(hasVBA, policyID) => (
<>
diff --git a/src/pages/workspace/travel/WorkspaceTravelVBAView.js b/src/pages/workspace/travel/WorkspaceTravelVBAView.js
index 3f9d450367b2..2ae098679d99 100644
--- a/src/pages/workspace/travel/WorkspaceTravelVBAView.js
+++ b/src/pages/workspace/travel/WorkspaceTravelVBAView.js
@@ -18,20 +18,20 @@ const propTypes = {
...withLocalizePropTypes,
};
-const WorkspaceTravelVBAView = ({translate}) => (
+const WorkspaceTravelVBAView = props => (
openOldDotLink('domain_companycards'),
icon: ExpensifyCard,
shouldShowRightIcon: true,
iconRight: NewWindow,
},
{
- title: translate('workspace.travel.bookTravelWithConcierge'),
+ title: props.translate('workspace.travel.bookTravelWithConcierge'),
onPress: () => {
navigateToConciergeChat();
},
@@ -39,7 +39,7 @@ const WorkspaceTravelVBAView = ({translate}) => (
shouldShowRightIcon: true,
},
{
- title: translate('requestorStep.learnMore'),
+ title: props.translate('requestorStep.learnMore'),
onPress: () => openExternalLink('https://community.expensify.com/discussion/7066/introducing-concierge-travel'),
icon: Info,
shouldShowRightIcon: true,
@@ -48,7 +48,7 @@ const WorkspaceTravelVBAView = ({translate}) => (
]}
>
- {translate('workspace.travel.VBACopy')}
+ {props.translate('workspace.travel.VBACopy')}
);
diff --git a/src/pages/workspace/withFullPolicy.js b/src/pages/workspace/withFullPolicy.js
index d55fa7a19aab..62eab380d1f8 100644
--- a/src/pages/workspace/withFullPolicy.js
+++ b/src/pages/workspace/withFullPolicy.js
@@ -80,13 +80,13 @@ export default function (WrappedComponent) {
previousRoute = lodashGet(currentRoute, 'path', '');
- const {forwardedRef, policy, ...rest} = props;
+ const rest = _.omit(props, ['forwardedRef', 'policy']);
return (
);
};