diff --git a/src/libs/ValidationUtils.ts b/src/libs/ValidationUtils.ts index 87dcede7f0c9..5fedd5443a89 100644 --- a/src/libs/ValidationUtils.ts +++ b/src/libs/ValidationUtils.ts @@ -407,7 +407,7 @@ function isNumeric(value: string): boolean { if (typeof value !== 'string') { return false; } - return /^\d*$/.test(value); + return CONST.REGEX.NUMBER.test(value); } /** diff --git a/src/pages/home/ReportScreen.tsx b/src/pages/home/ReportScreen.tsx index f1c658b5db07..d8d98fe32d96 100644 --- a/src/pages/home/ReportScreen.tsx +++ b/src/pages/home/ReportScreen.tsx @@ -40,6 +40,7 @@ import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils'; import * as ReportActionsUtils from '@libs/ReportActionsUtils'; import * as ReportUtils from '@libs/ReportUtils'; import shouldFetchReport from '@libs/shouldFetchReport'; +import * as ValidationUtils from '@libs/ValidationUtils'; import type {AuthScreensParamList} from '@navigation/types'; import variables from '@styles/variables'; import * as ComposerActions from '@userActions/Composer'; @@ -169,8 +170,8 @@ function ReportScreen({ // Don't update if there is a reportID in the params already if (route.params.reportID) { const reportActionID = route?.params?.reportActionID; - const regexValidReportActionID = new RegExp(/^\d*$/); - if (reportActionID && !regexValidReportActionID.test(reportActionID)) { + const isValidReportActionID = ValidationUtils.isNumeric(reportActionID); + if (reportActionID && !isValidReportActionID) { navigation.setParams({reportActionID: ''}); } return;