Skip to content

Commit

Permalink
ref: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
kubabutkiewicz committed Jan 12, 2024
1 parent e54abdf commit 1c13e82
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 257 deletions.
2 changes: 1 addition & 1 deletion src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3559,7 +3559,7 @@ function getAllPolicyReports(policyID: string): Array<OnyxEntry<Report>> {
/**
* Returns true if Chronos is one of the chat participants (1:1)
*/
function chatIncludesChronos(report: OnyxEntry<Report>): boolean {
function chatIncludesChronos(report: OnyxEntry<Report> | EmptyObject): boolean {
return Boolean(report?.participantAccountIDs?.includes(CONST.ACCOUNT_ID.CHRONOS));
}

Expand Down
2 changes: 1 addition & 1 deletion src/libs/focusTextInputAfterAnimation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type FocusTextInputAfterAnimation from './types';
* This library is a no-op for all platforms except for Android and iOS and will immediately focus the given input without any delays.
*/
const focusTextInputAfterAnimation: FocusTextInputAfterAnimation = (inputRef) => {
inputRef.focus();
inputRef?.focus();
};

export default focusTextInputAfterAnimation;
2 changes: 1 addition & 1 deletion src/libs/focusTextInputAfterAnimation/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type {TextInput} from 'react-native';

type FocusTextInputAfterAnimation = (inputRef: TextInput | HTMLInputElement, animationLength: number) => void;
type FocusTextInputAfterAnimation = (inputRef: TextInput | HTMLInputElement | undefined, animationLength: number) => void;

export default FocusTextInputAfterAnimation;
10 changes: 5 additions & 5 deletions src/libs/isReportMessageAttachment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import type {Message} from '@src/types/onyx/ReportAction';
*
* @param reportActionMessage report action's message as text, html and translationKey
*/
export default function isReportMessageAttachment({text, html, translationKey}: Message): boolean {
if (!text || !html) {
export default function isReportMessageAttachment(message: Message | undefined): boolean {
if (!message?.text || !message?.html) {
return false;
}

if (translationKey && text === CONST.ATTACHMENT_MESSAGE_TEXT) {
return translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT;
if (message?.translationKey && message?.text === CONST.ATTACHMENT_MESSAGE_TEXT) {
return message?.translationKey === CONST.TRANSLATION_KEYS.ATTACHMENT;
}

const regex = new RegExp(` ${CONST.ATTACHMENT_SOURCE_ATTRIBUTE}="(.*)"`, 'i');
return text === CONST.ATTACHMENT_MESSAGE_TEXT && (!!html.match(regex) || html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML);
return message?.text === CONST.ATTACHMENT_MESSAGE_TEXT && (!!message?.html.match(regex) || message?.html === CONST.ATTACHMENT_UPLOADING_MESSAGE_HTML);
}
Loading

0 comments on commit 1c13e82

Please sign in to comment.