diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/index.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer.tsx similarity index 93% rename from src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/index.tsx rename to src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer.tsx index e4351ebe961a..66e297e50734 100644 --- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/index.tsx +++ b/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer.tsx @@ -1,5 +1,5 @@ import isEmpty from 'lodash/isEmpty'; -import React, {useContext, useMemo} from 'react'; +import React, {useMemo} from 'react'; import type {TextStyle} from 'react-native'; import {StyleSheet} from 'react-native'; import type {OnyxCollection, OnyxEntry} from 'react-native-onyx'; @@ -16,7 +16,6 @@ import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {Report} from '@src/types/onyx'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; -import MentionReportContext from './MentionReportContext'; type MentionReportOnyxProps = { /** All reports shared with the user */ @@ -57,12 +56,10 @@ function MentionReportRenderer({style, tnode, TDefaultRenderer, reports, ...defa const styles = useThemeStyles(); const StyleUtils = useStyleUtils(); const htmlAttributeReportID = tnode.attributes.reportid; - const {currentReportID: currentReportIDContext} = useContext(MentionReportContext); const currentReportID = useCurrentReportID(); - const currentReportIDValue = currentReportIDContext ?? currentReportID?.currentReportID; // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - const [currentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentReportIDValue || -1}`); + const [currentReport] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${currentReportID?.currentReportID || -1}`); // When we invite someone to a room they don't have the policy object, but we still want them to be able to see and click on report mentions, so we only check if the policyID in the report is from a workspace const isGroupPolicyReport = useMemo(() => currentReport && !isEmptyObject(currentReport) && !!currentReport.policyID && currentReport.policyID !== CONST.POLICY.ID_FAKE, [currentReport]); @@ -74,7 +71,7 @@ function MentionReportRenderer({style, tnode, TDefaultRenderer, reports, ...defa const {reportID, mentionDisplayText} = mentionDetails; const navigationRoute = reportID ? ROUTES.REPORT_WITH_ID.getRoute(reportID) : undefined; - const isCurrentRoomMention = reportID === currentReportIDValue; + const isCurrentRoomMention = reportID === currentReportID?.currentReportID; const flattenStyle = StyleSheet.flatten(style as TextStyle); const {color, ...styleWithoutColor} = flattenStyle; diff --git a/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext.tsx b/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext.tsx deleted file mode 100644 index 9fe1088c9809..000000000000 --- a/src/components/HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import {createContext} from 'react'; - -type MentionReportContextProps = { - currentReportID: string; -}; - -const MentionReportContext = createContext({ - currentReportID: '', -}); - -export default MentionReportContext; diff --git a/src/components/MenuItem.tsx b/src/components/MenuItem.tsx index 49eca50d4680..2c830e8515db 100644 --- a/src/components/MenuItem.tsx +++ b/src/components/MenuItem.tsx @@ -273,9 +273,6 @@ type MenuItemBaseProps = { /** Whether should render error text as HTML or as Text */ shouldRenderErrorAsHTML?: boolean; - /** List of markdown rules that will be ignored */ - excludedMarkdownRules?: string[]; - /** Should check anonymous user in onPress function */ shouldCheckActionAllowedOnPress?: boolean; @@ -412,7 +409,6 @@ function MenuItem( shouldParseHelperText = false, shouldRenderHintAsHTML = false, shouldRenderErrorAsHTML = false, - excludedMarkdownRules = [], shouldCheckActionAllowedOnPress = true, onSecondaryInteraction, titleWithTooltips, @@ -468,8 +464,8 @@ function MenuItem( if (!title || !shouldParseTitle) { return ''; } - return Parser.replace(title, {shouldEscapeText, disabledRules: excludedMarkdownRules}); - }, [title, shouldParseTitle, shouldEscapeText, excludedMarkdownRules]); + return Parser.replace(title, {shouldEscapeText}); + }, [title, shouldParseTitle, shouldEscapeText]); const helperHtml = useMemo(() => { if (!helperText || !shouldParseHelperText) { diff --git a/src/components/MoneyRequestConfirmationListFooter.tsx b/src/components/MoneyRequestConfirmationListFooter.tsx index ff18b48d5901..623348a4c7a4 100644 --- a/src/components/MoneyRequestConfirmationListFooter.tsx +++ b/src/components/MoneyRequestConfirmationListFooter.tsx @@ -28,7 +28,6 @@ import type * as OnyxTypes from '@src/types/onyx'; import type {Participant} from '@src/types/onyx/IOU'; import type {Unit} from '@src/types/onyx/Policy'; import ConfirmedRoute from './ConfirmedRoute'; -import MentionReportContext from './HTMLEngineProvider/HTMLRenderers/MentionReportRenderer/MentionReportContext'; import MenuItem from './MenuItem'; import MenuItemWithTopDescription from './MenuItemWithTopDescription'; import PDFThumbnail from './PDFThumbnail'; @@ -267,8 +266,6 @@ function MoneyRequestConfirmationListFooter({ const resolvedThumbnail = isLocalFile ? receiptThumbnail : tryResolveUrlFromApiRoot(receiptThumbnail ?? ''); const resolvedReceiptImage = isLocalFile ? receiptImage : tryResolveUrlFromApiRoot(receiptImage ?? ''); - const mentionReportContextValue = useMemo(() => ({currentReportID: reportID}), [reportID]); - // An intermediate structure that helps us classify the fields as "primary" and "supplementary". // The primary fields are always shown to the user, while an extra action is needed to reveal the supplementary ones. const classifiedFields = [ @@ -299,26 +296,23 @@ function MoneyRequestConfirmationListFooter({ }, { item: ( - - { - Navigation.navigate( - ROUTES.MONEY_REQUEST_STEP_DESCRIPTION.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRouteWithoutParams(), reportActionID), - ); - }} - style={[styles.moneyRequestMenuItem]} - titleStyle={styles.flex1} - disabled={didConfirm} - interactive={!isReadOnly} - numberOfLinesTitle={2} - /> - + { + Navigation.navigate( + ROUTES.MONEY_REQUEST_STEP_DESCRIPTION.getRoute(action, iouType, transactionID, reportID, Navigation.getActiveRouteWithoutParams(), reportActionID), + ); + }} + style={[styles.moneyRequestMenuItem]} + titleStyle={styles.flex1} + disabled={didConfirm} + interactive={!isReadOnly} + numberOfLinesTitle={2} + /> ), shouldShow: true, isSupplementary: false, diff --git a/src/components/TextInput/BaseTextInput/index.native.tsx b/src/components/TextInput/BaseTextInput/index.native.tsx index a03e9dbb9aa2..59f205da023f 100644 --- a/src/components/TextInput/BaseTextInput/index.native.tsx +++ b/src/components/TextInput/BaseTextInput/index.native.tsx @@ -61,7 +61,6 @@ function BaseTextInput( prefixCharacter = '', inputID, isMarkdownEnabled = false, - excludedMarkdownStyles = [], shouldShowClearButton = false, prefixContainerStyle = [], prefixStyle = [], @@ -75,7 +74,7 @@ function BaseTextInput( const inputProps = {shouldSaveDraft: false, shouldUseDefaultValue: false, ...props}; const theme = useTheme(); const styles = useThemeStyles(); - const markdownStyle = useMarkdownStyle(undefined, excludedMarkdownStyles); + const markdownStyle = useMarkdownStyle(); const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); diff --git a/src/components/TextInput/BaseTextInput/index.tsx b/src/components/TextInput/BaseTextInput/index.tsx index c5471fa11bce..3f55ff97ff02 100644 --- a/src/components/TextInput/BaseTextInput/index.tsx +++ b/src/components/TextInput/BaseTextInput/index.tsx @@ -64,7 +64,6 @@ function BaseTextInput( suffixCharacter = '', inputID, isMarkdownEnabled = false, - excludedMarkdownStyles = [], shouldShowClearButton = false, prefixContainerStyle = [], prefixStyle = [], @@ -79,7 +78,7 @@ function BaseTextInput( const theme = useTheme(); const styles = useThemeStyles(); - const markdownStyle = useMarkdownStyle(undefined, excludedMarkdownStyles); + const markdownStyle = useMarkdownStyle(); const {hasError = false} = inputProps; const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); diff --git a/src/components/TextInput/BaseTextInput/types.ts b/src/components/TextInput/BaseTextInput/types.ts index 32a408e4d348..5b05d9d8613b 100644 --- a/src/components/TextInput/BaseTextInput/types.ts +++ b/src/components/TextInput/BaseTextInput/types.ts @@ -1,4 +1,3 @@ -import type {MarkdownStyle} from '@expensify/react-native-live-markdown'; import type {GestureResponderEvent, StyleProp, TextInputProps, TextStyle, ViewStyle} from 'react-native'; import type {AnimatedTextInputRef} from '@components/RNTextInput'; import type IconAsset from '@src/types/utils/IconAsset'; @@ -116,9 +115,6 @@ type CustomBaseTextInputProps = { /** Should live markdown be enabled. Changes RNTextInput component to RNMarkdownTextInput */ isMarkdownEnabled?: boolean; - /** List of markdowns that won't be styled as a markdown */ - excludedMarkdownStyles?: Array; - /** Whether the clear button should be displayed */ shouldShowClearButton?: boolean; diff --git a/src/pages/iou/request/step/IOURequestStepDescription.tsx b/src/pages/iou/request/step/IOURequestStepDescription.tsx index a4c6ce577798..993bf580f038 100644 --- a/src/pages/iou/request/step/IOURequestStepDescription.tsx +++ b/src/pages/iou/request/step/IOURequestStepDescription.tsx @@ -149,8 +149,6 @@ function IOURequestStepDescription({ const canEditSplitBill = isSplitBill && reportAction && session?.accountID === reportAction.actorAccountID && TransactionUtils.areRequiredFieldsEmpty(transaction); // eslint-disable-next-line rulesdir/no-negated-variables const shouldShowNotFoundPage = isEditing && (isSplitBill ? !canEditSplitBill : !ReportActionsUtils.isMoneyRequestAction(reportAction) || !ReportUtils.canEditMoneyRequest(reportAction)); - const isReportInGroupPolicy = !!report?.policyID && report.policyID !== CONST.POLICY.ID_FAKE; - return (