-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error props being incorrectly accessed in components #23394
Changes from 5 commits
2f34d2b
2605c41
5f8cc76
dc343dd
8bead86
9902cca
839b936
65520c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,6 @@ import PropTypes from 'prop-types'; | |
import React, {useCallback, useEffect, useState} from 'react'; | ||
import Animated, {useSharedValue, useAnimatedStyle, withTiming} from 'react-native-reanimated'; | ||
import _ from 'underscore'; | ||
import lodashGet from 'lodash/get'; | ||
import InvertedFlatList from '../../../components/InvertedFlatList'; | ||
import compose from '../../../libs/compose'; | ||
import styles from '../../../styles/styles'; | ||
|
@@ -164,10 +163,8 @@ function ReportActionsList(props) { | |
const extraData = [props.isSmallScreenWidth ? props.newMarkerReportActionID : undefined, ReportUtils.isArchivedRoom(props.report)]; | ||
const shouldShowReportRecipientLocalTime = ReportUtils.canShowReportRecipientLocalTime(props.personalDetailsList, props.report, props.currentUserPersonalDetails.accountID); | ||
|
||
const errors = lodashGet(props.report, 'errorFields.addWorkspaceRoom') || lodashGet(props.report, 'errorFields.createChat'); | ||
const isArchivedRoom = ReportUtils.isArchivedRoom(props.report); | ||
const hideComposer = ReportUtils.shouldHideComposer(props.report, errors); | ||
const shouldOmitBottomSpace = hideComposer || isArchivedRoom; | ||
// If composer is hidden, omit the bottom space. | ||
const shouldOmitBottomSpace = ReportUtils.shouldHideComposer(props.report); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Archived report is already checked in |
||
|
||
return ( | ||
<Animated.View style={[animatedStyles, styles.flex1]}> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React, {useState, useMemo, useCallback, useEffect} from 'react'; | ||
import React, {useState, useMemo, useCallback} from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import {withOnyx} from 'react-native-onyx'; | ||
import _ from 'underscore'; | ||
|
@@ -17,8 +17,6 @@ import * as CurrencyUtils from '../../libs/CurrencyUtils'; | |
import ROUTES from '../../ROUTES'; | ||
import themeColors from '../../styles/themes/default'; | ||
import * as Expensicons from '../../components/Icon/Expensicons'; | ||
import reportPropTypes from '../reportPropTypes'; | ||
import * as ReportUtils from '../../libs/ReportUtils'; | ||
|
||
const greenCheckmark = {src: Expensicons.Checkmark, color: themeColors.success}; | ||
|
||
|
@@ -45,19 +43,10 @@ const propTypes = { | |
currency: PropTypes.string, | ||
}), | ||
|
||
/** The report on which the request is initiated on */ | ||
report: reportPropTypes, | ||
|
||
/** Any errors associated with an attempt to create a chat */ | ||
// eslint-disable-next-line react/forbid-prop-types | ||
errors: PropTypes.object, | ||
|
||
...withLocalizePropTypes, | ||
}; | ||
|
||
const defaultProps = { | ||
report: {}, | ||
errors: {}, | ||
currencyList: {}, | ||
iou: { | ||
currency: CONST.CURRENCY.USD, | ||
|
@@ -71,15 +60,6 @@ function IOUCurrencySelection(props) { | |
const iouType = lodashGet(props.route, 'params.iouType', CONST.IOU.MONEY_REQUEST_TYPE.REQUEST); | ||
const reportID = lodashGet(props.route, 'params.reportID', ''); | ||
|
||
const shouldDismissModal = ReportUtils.shouldHideComposer(props.report, props.errors); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mollfpr I removed this from IOUCurrencySelection page because we don't need to add it here. We check this in I even tried by pressing browser forward button but it did not let me go to that screen. I did see your comment here and wondered why it was not working before. Anyway, please let me know if it doesn't work for you. |
||
useEffect(() => { | ||
if (!shouldDismissModal) { | ||
return; | ||
} | ||
Navigation.dismissModal(reportID); | ||
}, [shouldDismissModal, reportID]); | ||
|
||
const confirmCurrencySelection = useCallback( | ||
(option) => { | ||
const backTo = lodashGet(props.route, 'params.backTo', ''); | ||
|
@@ -165,9 +145,6 @@ export default compose( | |
withOnyx({ | ||
currencyList: {key: ONYXKEYS.CURRENCY_LIST}, | ||
iou: {key: ONYXKEYS.IOU}, | ||
report: { | ||
key: ({route}) => `${ONYXKEYS.COLLECTION.REPORT}${lodashGet(route, 'params.reportID', '')}`, | ||
}, | ||
}), | ||
withNetwork(), | ||
)(IOUCurrencySelection); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
except this line and line 389 where errors are no longer passed to
ReportFooter
, the rest code in this file is reverting the PR that was blocking us - https://github.com/Expensify/App/pull/22787/files