-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37199 from burczu/feature/35713-bulk-actions
Feature/35713 bulk actions
- Loading branch information
Showing
28 changed files
with
383 additions
and
162 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import type {RefObject} from 'react'; | ||
import type {GestureResponderEvent, StyleProp, View, ViewStyle} from 'react-native'; | ||
import type {ValueOf} from 'type-fest'; | ||
import type 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'; | ||
|
||
type PaymentType = DeepValueOf<typeof CONST.IOU.PAYMENT_TYPE | typeof CONST.IOU.REPORT_ACTION_TYPE>; | ||
|
||
type WorkspaceMemberBulkActionType = DeepValueOf<typeof CONST.POLICY.MEMBERS_BULK_ACTION_TYPES>; | ||
|
||
type DropdownOption<TValueType> = { | ||
value: TValueType; | ||
text: string; | ||
icon: IconAsset; | ||
iconWidth?: number; | ||
iconHeight?: number; | ||
iconDescription?: string; | ||
onSelected?: () => void; | ||
}; | ||
|
||
type ButtonWithDropdownMenuProps<TValueType> = { | ||
/** The custom text to display on the main button instead of selected option */ | ||
customText?: string; | ||
|
||
/** Text to display for the menu header */ | ||
menuHeaderText?: string; | ||
|
||
/** Callback to execute when the main button is pressed */ | ||
onPress: (event: GestureResponderEvent | KeyboardEvent | undefined, value: TValueType) => void; | ||
|
||
/** Callback to execute when a dropdown option is selected */ | ||
onOptionSelected?: (option: DropdownOption<TValueType>) => void; | ||
|
||
/** Call the onPress function on main button when Enter key is pressed */ | ||
pressOnEnter?: boolean; | ||
|
||
/** Whether we should show a loading state for the main button */ | ||
isLoading?: boolean; | ||
|
||
/** The size of button size */ | ||
buttonSize: ValueOf<typeof CONST.DROPDOWN_BUTTON_SIZE>; | ||
|
||
/** Should the confirmation button be disabled? */ | ||
isDisabled?: boolean; | ||
|
||
/** Additional styles to add to the component */ | ||
style?: StyleProp<ViewStyle>; | ||
|
||
/** Menu options to display */ | ||
/** e.g. [{text: 'Pay with Expensify', icon: Wallet}] */ | ||
options: Array<DropdownOption<TValueType>>; | ||
|
||
/** The anchor alignment of the popover menu */ | ||
anchorAlignment?: AnchorAlignment; | ||
|
||
/* ref for the button */ | ||
buttonRef: RefObject<View>; | ||
|
||
/** The priority to assign the enter key event listener to buttons. 0 is the highest priority. */ | ||
enterKeyEventListenerPriority?: number; | ||
|
||
/** Whether the button should use success style or not */ | ||
success?: boolean; | ||
|
||
/** Whether the dropdown menu should be shown even if it has only one option */ | ||
shouldAlwaysShowDropdownMenu?: boolean; | ||
}; | ||
|
||
export type {PaymentType, WorkspaceMemberBulkActionType, DropdownOption, ButtonWithDropdownMenuProps}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.