diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index e0c7f6e6bc95..86eb8c56345e 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -276,7 +276,7 @@ class AttachmentModal extends PureComponent { source={this.props.source} onToggleKeyboard={this.updateConfirmButtonVisibility} /> - ) : this.state.source && this.state.shouldLoadAttachment && ( + ) : Boolean(this.state.source) && this.state.shouldLoadAttachment && ( {/* If we have an onConfirm method show a confirmation button */} - {this.props.onConfirm && ( + {Boolean(this.props.onConfirm) && ( {({safeAreaPaddingBottomStyle}) => ( diff --git a/src/components/ImageView/index.native.js b/src/components/ImageView/index.native.js index 70ce7b907e98..11732715b941 100644 --- a/src/components/ImageView/index.native.js +++ b/src/components/ImageView/index.native.js @@ -175,7 +175,7 @@ class ImageView extends PureComponent { }); }} > - {this.state.containerHeight && ( + {Boolean(this.state.containerHeight) && ( this.zoom = el} onClick={() => this.props.onPress()} diff --git a/src/components/MenuItem.js b/src/components/MenuItem.js index 8e1e089148db..527b2620e557 100644 --- a/src/components/MenuItem.js +++ b/src/components/MenuItem.js @@ -92,7 +92,7 @@ const MenuItem = (props) => { {({hovered, pressed}) => ( <> - {props.icon && ( + {Boolean(props.icon) && ( { - {props.badgeText && ( + {Boolean(props.badgeText) && ( } - {this.props.option.customIcon && ( + {Boolean(this.props.option.customIcon) && ( - {this.props.label && ( + {Boolean(this.props.label) && ( {this.props.label} @@ -223,7 +223,7 @@ class BasePicker extends PureComponent { {this.props.value} - {this.props.hintText + {Boolean(this.props.hintText) && ( {this.props.hintText} @@ -289,7 +289,7 @@ class BasePicker extends PureComponent { /> - {this.props.hintText + {Boolean(this.props.hintText) && ( {this.props.hintText} diff --git a/src/components/RadioButtonWithLabel.js b/src/components/RadioButtonWithLabel.js index 7665cb3f9159..6567eff86de9 100644 --- a/src/components/RadioButtonWithLabel.js +++ b/src/components/RadioButtonWithLabel.js @@ -67,12 +67,12 @@ const RadioButtonWithLabel = (props) => { styles.alignItemsCenter, ]} > - {props.label && ( + {Boolean(props.label) && ( {props.label} )} - {LabelComponent && ()} + {Boolean(LabelComponent) && ()} diff --git a/src/components/ReportActionItem/IOUPreview.js b/src/components/ReportActionItem/IOUPreview.js index 2afb7e7fc1df..a835f1d1a4a3 100644 --- a/src/components/ReportActionItem/IOUPreview.js +++ b/src/components/ReportActionItem/IOUPreview.js @@ -101,6 +101,11 @@ const propTypes = { /** Pending action, if any */ pendingAction: PropTypes.oneOf(_.values(CONST.RED_BRICK_ROAD_PENDING_ACTION)), + /** Whether or not an IOU report contains money requests in a different currency + * that are either created or cancelled offline, and thus haven't been converted to the report's currency yet + */ + shouldShowPendingConversionMessage: PropTypes.bool, + ...withLocalizePropTypes, }; @@ -120,6 +125,7 @@ const defaultProps = { session: { email: null, }, + shouldShowPendingConversionMessage: false, }; const IOUPreview = (props) => { diff --git a/src/components/ScreenWrapper/propTypes.js b/src/components/ScreenWrapper/propTypes.js index 4345f60fad48..1328f2929d18 100644 --- a/src/components/ScreenWrapper/propTypes.js +++ b/src/components/ScreenWrapper/propTypes.js @@ -1,4 +1,5 @@ import PropTypes from 'prop-types'; +import {windowDimensionsPropTypes} from '../withWindowDimensions'; const propTypes = { /** Array of additional styles to add */ @@ -31,6 +32,8 @@ const propTypes = { /** Whether to dismiss keyboard before leaving a screen */ shouldDismissKeyboardBeforeClose: PropTypes.bool, + + ...windowDimensionsPropTypes, }; const defaultProps = { diff --git a/src/components/Section.js b/src/components/Section.js index cbed28c3de12..e14d7d4dd398 100644 --- a/src/components/Section.js +++ b/src/components/Section.js @@ -46,8 +46,8 @@ const Section = (props) => { {props.title} - {props.icon && } - {IconComponent && } + {Boolean(props.icon) && } + {Boolean(IconComponent) && } @@ -56,7 +56,7 @@ const Section = (props) => { - {props.menuItems && } + {Boolean(props.menuItems) && } diff --git a/src/components/TextInput/BaseTextInput.js b/src/components/TextInput/BaseTextInput.js index d85aea8a71a0..bed1129abbe9 100644 --- a/src/components/TextInput/BaseTextInput.js +++ b/src/components/TextInput/BaseTextInput.js @@ -316,7 +316,7 @@ class BaseTextInput extends Component { dataSet={{submitOnEnter: this.props.multiline && this.props.submitOnEnter}} /> - {this.props.secureTextEntry && ( + {Boolean(this.props.secureTextEntry) && ( )} - {!this.props.secureTextEntry && this.props.icon && ( + {!this.props.secureTextEntry && Boolean(this.props.icon) && ( )} - {this.shouldShowRequestCodeLink() && codeRequestedErrors + {this.shouldShowRequestCodeLink() && Boolean(codeRequestedErrors) && (
@@ -100,7 +100,7 @@ class ExpiredValidateCodeModal extends PureComponent { {codeRequestedErrors}
)} - {this.shouldShowRequestCodeLink() && codeRequestedMessage + {this.shouldShowRequestCodeLink() && Boolean(codeRequestedMessage) && (
diff --git a/src/pages/DetailsPage.js b/src/pages/DetailsPage.js index 3b5b83796d43..fd8b5f961d41 100755 --- a/src/pages/DetailsPage.js +++ b/src/pages/DetailsPage.js @@ -149,7 +149,7 @@ class DetailsPage extends React.PureComponent { )} - {details.displayName && ( + {Boolean(details.displayName) && ( {isSMSLogin ? this.props.toLocalPhone(details.displayName) : details.displayName} diff --git a/src/pages/EnablePayments/TermsPage/LongTermsForm.js b/src/pages/EnablePayments/TermsPage/LongTermsForm.js index 00f630e12ab9..5829f2e8739c 100644 --- a/src/pages/EnablePayments/TermsPage/LongTermsForm.js +++ b/src/pages/EnablePayments/TermsPage/LongTermsForm.js @@ -65,7 +65,7 @@ const getLongTermsSections = () => _.map(termsData, (section, index) => ( {section.title} { - section.subTitle + Boolean(section.subTitle) && ( {section.subTitle} @@ -78,7 +78,7 @@ const getLongTermsSections = () => _.map(termsData, (section, index) => ( {section.rightText} { - section.subRightText + Boolean(section.subRightText) && ( {section.subRightText} diff --git a/src/pages/ReimbursementAccount/ACHContractStep.js b/src/pages/ReimbursementAccount/ACHContractStep.js index 26e2dd0ee410..414b9f44414a 100644 --- a/src/pages/ReimbursementAccount/ACHContractStep.js +++ b/src/pages/ReimbursementAccount/ACHContractStep.js @@ -218,7 +218,7 @@ class ACHContractStep extends React.Component { defaultValue={this.props.getDefaultStateForField('hasOtherBeneficialOwners', false)} shouldSaveDraft /> - {inputValues.hasOtherBeneficialOwners && ( + {Boolean(inputValues.hasOtherBeneficialOwners) && ( {_.map(this.state.beneficialOwners, (ownerKey, index) => ( diff --git a/src/pages/ReimbursementAccount/BankAccountStep.js b/src/pages/ReimbursementAccount/BankAccountStep.js index a6ad01b8a4f9..fd944c6ea907 100644 --- a/src/pages/ReimbursementAccount/BankAccountStep.js +++ b/src/pages/ReimbursementAccount/BankAccountStep.js @@ -112,7 +112,7 @@ const BankAccountStep = (props) => { {props.translate('bankAccount.toGetStarted')} - {plaidDesktopMessage && ( + {Boolean(plaidDesktopMessage) && ( {props.translate(plaidDesktopMessage)} @@ -130,7 +130,7 @@ const BankAccountStep = (props) => { success large /> - {props.error && ( + {Boolean(props.error) && ( {props.error} diff --git a/src/pages/ReimbursementAccount/EnableStep.js b/src/pages/ReimbursementAccount/EnableStep.js index fa5f89bdd3ab..2b54f7eab1fa 100644 --- a/src/pages/ReimbursementAccount/EnableStep.js +++ b/src/pages/ReimbursementAccount/EnableStep.js @@ -107,7 +107,7 @@ const EnableStep = (props) => { wrapperStyle={[styles.cardMenuItem, styles.mv3]} /> - {props.user.isCheckingDomain && ( + {Boolean(props.user.isCheckingDomain) && ( {props.translate('workspace.card.checkingDomain')} diff --git a/src/pages/ReportSettingsPage.js b/src/pages/ReportSettingsPage.js index f3af110f6860..dfb5c19f92ff 100644 --- a/src/pages/ReportSettingsPage.js +++ b/src/pages/ReportSettingsPage.js @@ -216,7 +216,7 @@ class ReportSettingsPage extends Component { )} - {linkedWorkspace && ( + {Boolean(linkedWorkspace) && ( {this.props.translate('workspace.common.workspace')} @@ -226,7 +226,7 @@ class ReportSettingsPage extends Component { )} - {this.props.report.visibility && ( + {Boolean(this.props.report.visibility) && ( {this.props.translate('newRoomPage.visibility')} diff --git a/src/pages/home/ReportScreen.js b/src/pages/home/ReportScreen.js index 8ea0eec9cb7f..df5ba50e622a 100644 --- a/src/pages/home/ReportScreen.js +++ b/src/pages/home/ReportScreen.js @@ -281,7 +281,7 @@ class ReportScreen extends React.Component { policies={this.props.policies} /> - {this.props.accountManagerReportID && ReportUtils.isConciergeChatReport(this.props.report) && this.state.isBannerVisible && ( + {Boolean(this.props.accountManagerReportID) && ReportUtils.isConciergeChatReport(this.props.report) && this.state.isBannerVisible && ( { style={[EmojiUtils.containsOnlyEmojis(text) ? styles.onlyEmojisText : undefined, styles.ltr, ...props.style]} > {StyleUtils.convertToLTR(Str.htmlDecode(text))} - {props.fragment.isEdited && ( + {Boolean(props.fragment.isEdited) && ( - {this.props.currentUserPersonalDetails.displayName && ( + {Boolean(this.props.currentUserPersonalDetails.displayName) && ( )} - {this.props.account && !_.isEmpty(this.props.account.errors) && ( + {Boolean(this.props.account) && !_.isEmpty(this.props.account.errors) && ( )} diff --git a/src/pages/signin/SignInPage.js b/src/pages/signin/SignInPage.js index 88c95ebee891..53c4d5545485 100644 --- a/src/pages/signin/SignInPage.js +++ b/src/pages/signin/SignInPage.js @@ -68,7 +68,7 @@ class SignInPage extends Component { // - AND a password hasn't been entered yet // - AND haven't forgotten password // - AND the user is NOT on the passwordless beta - const showPasswordForm = this.props.credentials.login + const showPasswordForm = Boolean(this.props.credentials.login) && this.props.account.validated && !this.props.credentials.password && !this.props.account.forgotPassword @@ -85,7 +85,7 @@ class SignInPage extends Component { // - A login has been entered // - AND is not validated or password is forgotten // - AND user is not on 'passwordless' beta - const showResendValidationForm = this.props.credentials.login + const showResendValidationForm = Boolean(this.props.credentials.login) && (!this.props.account.validated || this.props.account.forgotPassword) && !Permissions.canUsePasswordlessLogins(this.props.betas); diff --git a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js index 10b0cefdabb1..06443c696cc0 100755 --- a/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js +++ b/src/pages/signin/ValidateCodeForm/BaseValidateCodeForm.js @@ -245,7 +245,7 @@ class BaseValidateCodeForm extends React.Component { )} - {this.props.account && !_.isEmpty(this.props.account.errors) && ( + {Boolean(this.props.account) && !_.isEmpty(this.props.account.errors) && ( )} diff --git a/src/pages/workspace/card/WorkspaceCardVBANoECardView.js b/src/pages/workspace/card/WorkspaceCardVBANoECardView.js index 63148155888f..dbf9a213c832 100644 --- a/src/pages/workspace/card/WorkspaceCardVBANoECardView.js +++ b/src/pages/workspace/card/WorkspaceCardVBANoECardView.js @@ -57,7 +57,7 @@ const WorkspaceCardVBANoECardView = props => ( success /> - {props.user.isCheckingDomain && ( + {Boolean(props.user.isCheckingDomain) && ( {props.translate('workspace.card.checkingDomain')} diff --git a/src/stories/Composer.stories.js b/src/stories/Composer.stories.js index f94c834a8d5e..d3617664cb56 100644 --- a/src/stories/Composer.stories.js +++ b/src/stories/Composer.stories.js @@ -64,7 +64,7 @@ const Default = (args) => { > Rendered Comment {Boolean(renderedHTML) && } - {pastedFile && ( + {Boolean(pastedFile) && (