Skip to content

Commit

Permalink
Apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
ShridharGoel authored Aug 24, 2024
1 parent 1bd37d5 commit 43d8212
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/Composer/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function Composer(
const pasteFile = useCallback(
(e: NativeSyntheticEvent<TextInputPasteEventData>) => {
const clipboardContent = e.nativeEvent.items.at(0);
if (clipboardContent.type === 'text/plain') {
if (clipboardContent?.type === 'text/plain') {
return;
}
const fileURI = clipboardContent.data;
Expand Down
2 changes: 1 addition & 1 deletion src/components/DisplayNames/DisplayNamesWithTooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function DisplayNamesWithToolTip({shouldUseFullTitle, fullTitle, displayNamesWit
const {width: containerWidth, left: containerLeft} = containerRef.current.getBoundingClientRect();

// We have to return the value as Number so we can't use `measureWindow` which takes a callback
const {width: textNodeWidth, left: textNodeLeft} = childRefs.current.at(index).getBoundingClientRect();
const {width: textNodeWidth, left: textNodeLeft} = childRefs.current.at(index)?.getBoundingClientRect();
const tooltipX = textNodeWidth / 2 + textNodeLeft;
const containerRight = containerWidth + containerLeft;
const textNodeRight = textNodeWidth + textNodeLeft;
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(
cameraRef.current?.setCamera({
zoomLevel: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
animationDuration: 1500,
centerCoordinate: waypoints.at(0).coordinate,
centerCoordinate: waypoints.at(0)?.coordinate,
});
} else {
const {southWest, northEast} = utils.getBounds(
Expand Down
2 changes: 1 addition & 1 deletion src/components/MapView/MapView.website.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const MapView = forwardRef<MapViewHandle, ComponentProps>(

if (waypoints.length === 1) {
mapRef.flyTo({
center: waypoints.at(0).coordinate,
center: waypoints.at(0)?.coordinate,
zoom: CONST.MAPBOX.SINGLE_MARKER_ZOOM,
});
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,10 @@ function MoneyRequestPreviewContent({
}

if (shouldShowRBR && transaction) {
const violations = TransactionUtils.getTransactionViolations(transaction.transactionID, transactionViolations);
if (shouldShowHoldMessage) {
return `${message} ${CONST.DOT_SEPARATOR} ${translate('violations.hold')}`;
}
if (violations?.[0]) {
const violations = TransactionUtils.getTransactionViolations(transaction.transactionID, transactionViolations)?.sort((a) =>
a.type === CONST.VIOLATION_TYPES.VIOLATION ? -1 : 0,
);
if (violations?.at(0)) {
const violationMessage = ViolationsUtils.getViolationTranslation(violations.at(0), translate);
const violationsCount = violations.filter((v) => v.type === CONST.VIOLATION_TYPES.VIOLATION).length;
const isTooLong = violationsCount > 1 || violationMessage.length > 15;
Expand Down
2 changes: 1 addition & 1 deletion src/libs/CurrencyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function isCurrencySymbolLTR(currencyCode: string): boolean {
});

// Currency is LTR when the first part is of currency type.
return parts.at(0).type === 'currency';
return parts.at(0)?.type === 'currency';
}

/**
Expand Down

0 comments on commit 43d8212

Please sign in to comment.