diff --git a/src/components/AvatarWithImagePicker.tsx b/src/components/AvatarWithImagePicker.tsx index 07c535ccd96c..fa8a6d71516f 100644 --- a/src/components/AvatarWithImagePicker.tsx +++ b/src/components/AvatarWithImagePicker.tsx @@ -6,6 +6,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as Browser from '@libs/Browser'; +import type {CustomRNImageManipulatorResult} from '@libs/cropOrRotateImage/types'; import * as FileUtils from '@libs/fileDownload/FileUtils'; import getImageResolution from '@libs/fileDownload/getImageResolution'; import type {AvatarSource} from '@libs/UserUtils'; @@ -54,7 +55,7 @@ type AvatarWithImagePickerProps = { disabledStyle?: StyleProp; /** Executed once an image has been selected */ - onImageSelected?: () => void; + onImageSelected?: (file: File | CustomRNImageManipulatorResult) => void; /** Execute when the user taps "remove" */ onImageRemoved?: () => void; @@ -87,7 +88,7 @@ type AvatarWithImagePickerProps = { pendingAction?: OnyxCommon.PendingAction; /** The errors to display */ - errors?: OnyxCommon.Errors; + errors?: OnyxCommon.Errors | null; /** Title for avatar preview modal */ headerTitle?: string; diff --git a/src/pages/workspace/WorkspaceProfilePage.tsx b/src/pages/workspace/WorkspaceProfilePage.tsx index 4ce5822dfaa0..48dfe10a2a0e 100644 --- a/src/pages/workspace/WorkspaceProfilePage.tsx +++ b/src/pages/workspace/WorkspaceProfilePage.tsx @@ -26,7 +26,6 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import ROUTES from '@src/ROUTES'; import type {CurrencyList} from '@src/types/onyx'; -import type * as OnyxCommon from '@src/types/onyx/OnyxCommon'; import {isEmptyObject} from '@src/types/utils/EmptyObject'; import withPolicy from './withPolicy'; import type {WithPolicyProps} from './withPolicy'; @@ -102,11 +101,11 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi fallbackIcon={Expensicons.FallbackWorkspaceAvatar} style={[styles.mb3, isSmallScreenWidth ? styles.mtn17 : styles.mtn20, styles.alignItemsStart, styles.sectionMenuItemTopDescription]} isUsingDefaultAvatar={!policy?.avatar ?? null} - onImageSelected={(file: File) => Policy.updateWorkspaceAvatar(policy?.id ?? '', file)} + onImageSelected={(file) => Policy.updateWorkspaceAvatar(policy?.id ?? '', file as File)} onImageRemoved={() => Policy.deleteWorkspaceAvatar(policy?.id ?? '')} editorMaskImage={Expensicons.ImageCropSquareMask} - pendingAction={policy?.pendingFields?.avatar ?? null} - errors={policy?.errorFields?.avatar ?? null} + pendingAction={policy?.pendingFields?.avatar} + errors={policy?.errorFields?.avatar} onErrorClose={() => Policy.clearAvatarErrors(policy?.id ?? '')} previewSource={UserUtils.getFullSizeAvatar(policy?.avatar ?? '')} headerTitle={translate('workspace.common.workspaceAvatar')} @@ -115,7 +114,7 @@ function WorkspaceProfilePage({policy, currencyList = {}, route}: WorkSpaceProfi disabledStyle={styles.cursorDefault} errorRowStyles={undefined} /> - + {(!StringUtils.isEmptyString(policy?.description ?? '') || !readOnly) && ( - + )} - + ), isActive: policy?.harvesting?.enabled ?? false, - pendingAction: policy?.pendingFields?.isAutoApprovalEnabled as PendingAction, + pendingAction: policy?.pendingFields?.isAutoApprovalEnabled, }, { icon: Illustrations.Approval, @@ -83,7 +82,7 @@ function WorkspaceWorkflowsPage({policy, route}: WorkspaceWorkflowsPageProps) { /> ), isActive: policy?.isAutoApprovalEnabled ?? false, - pendingAction: policy?.pendingFields?.approvalMode as PendingAction, + pendingAction: policy?.pendingFields?.approvalMode, }, { icon: Illustrations.WalletAlt, diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index 87974619ffc8..2844f63ab433 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -130,7 +130,7 @@ type Policy = { makeMeAdmin?: boolean; /** Pending fields for the policy */ - pendingFields?: Record; + pendingFields?: Record; /** Original file name which is used for the policy avatar */ originalFileName?: string;