Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[TS migration] Migrate 'MoneyRequestConfirmationList.js' component to TypeScript" #37529

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions src/components/ButtonWithDropdownMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,33 @@ import useWindowDimensions from '@hooks/useWindowDimensions';
import type {AnchorPosition} from '@styles/index';
import CONST from '@src/CONST';
import type AnchorAlignment from '@src/types/utils/AnchorAlignment';
import type DeepValueOf from '@src/types/utils/DeepValueOf';
import type IconAsset from '@src/types/utils/IconAsset';
import Button from './Button';
import Icon from './Icon';
import * as Expensicons from './Icon/Expensicons';
import PopoverMenu from './PopoverMenu';

type DropdownOption<T> = {
value: T;
type PaymentType = DeepValueOf<typeof CONST.IOU.PAYMENT_TYPE | typeof CONST.IOU.REPORT_ACTION_TYPE>;

type DropdownOption = {
value: PaymentType;
text: string;
icon?: IconAsset;
icon: IconAsset;
iconWidth?: number;
iconHeight?: number;
iconDescription?: string;
};

type ButtonWithDropdownMenuProps<T> = {
type ButtonWithDropdownMenuProps = {
/** Text to display for the menu header */
menuHeaderText?: string;

/** Callback to execute when the main button is pressed */
onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: T) => void;
onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: PaymentType) => void;

/** Callback to execute when a dropdown option is selected */
onOptionSelected?: (option: DropdownOption<T>) => void;
onOptionSelected?: (option: DropdownOption) => void;

/** Call the onPress function on main button when Enter key is pressed */
pressOnEnter?: boolean;
Expand All @@ -52,19 +55,19 @@ type ButtonWithDropdownMenuProps<T> = {

/** Menu options to display */
/** e.g. [{text: 'Pay with Expensify', icon: Wallet}] */
options: Array<DropdownOption<T>>;
options: DropdownOption[];

/** The anchor alignment of the popover menu */
anchorAlignment?: AnchorAlignment;

/* ref for the button */
buttonRef?: RefObject<View>;
buttonRef: RefObject<View>;

/** The priority to assign the enter key event listener to buttons. 0 is the highest priority. */
enterKeyEventListenerPriority?: number;
};

function ButtonWithDropdownMenu<T>({
function ButtonWithDropdownMenu({
isLoading = false,
isDisabled = false,
pressOnEnter = false,
Expand All @@ -80,7 +83,7 @@ function ButtonWithDropdownMenu<T>({
options,
onOptionSelected,
enterKeyEventListenerPriority = 0,
}: ButtonWithDropdownMenuProps<T>) {
}: ButtonWithDropdownMenuProps) {
const theme = useTheme();
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();
Expand Down
6 changes: 3 additions & 3 deletions src/components/ConfirmedRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ type ConfirmedRoutePropsOnyxProps = {

type ConfirmedRouteProps = ConfirmedRoutePropsOnyxProps & {
/** Transaction that stores the distance request data */
transaction: Transaction | undefined;
transaction: Transaction;
};

function ConfirmedRoute({mapboxAccessToken, transaction}: ConfirmedRouteProps) {
const {isOffline} = useNetwork();
const {route0: route} = transaction?.routes ?? {};
const waypoints = transaction?.comment?.waypoints ?? {};
const {route0: route} = transaction.routes ?? {};
const waypoints = transaction.comment?.waypoints ?? {};
const coordinates = route?.geometry?.coordinates ?? [];
const theme = useTheme();
const styles = useThemeStyles();
Expand Down
Loading
Loading