-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[TS migration] Migrate 'HeaderWithBackButton' component to TypeScript #33214
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
Merged
mountiny
merged 10 commits into
Expensify:main
from
VickyStash:ts-migration/headerWithBackButton-component
Dec 29, 2023
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
473fe21
[TS migration] Migrate 'HeaderWithBackButton' component
VickyStash 0142390
Update method name
VickyStash 96d9d39
Update comment, minor type updates
VickyStash dcb0c39
Minor code improvement
VickyStash eedbcf6
Reuse existing AnchorPosition type
VickyStash 621bbe4
Merge branch 'main' into ts-migration/headerWithBackButton-component
VickyStash 307c7b1
Merge branch 'main' into ts-migration/headerWithBackButton-component
VickyStash 1942625
TS fixes after merging main
VickyStash 654e903
Use IconAsset type
VickyStash 1e8b542
Update Header props type
VickyStash File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,113 @@ | ||
| import {ReactNode} from 'react'; | ||
| import {OnyxCollection, OnyxEntry} from 'react-native-onyx'; | ||
| import type {Action} from '@hooks/useSingleExecution'; | ||
| import type {StepCounterParams} from '@src/languages/types'; | ||
| import type {AnchorPosition} from '@src/styles'; | ||
| import type {PersonalDetails, Policy, Report} from '@src/types/onyx'; | ||
| import type ChildrenProps from '@src/types/utils/ChildrenProps'; | ||
| import type IconAsset from '@src/types/utils/IconAsset'; | ||
|
|
||
| type ThreeDotsMenuItems = { | ||
| /** An icon element displayed on the left side */ | ||
| icon?: IconAsset; | ||
|
|
||
| /** Text label */ | ||
| text: string; | ||
|
|
||
| /** A callback triggered when the item is selected */ | ||
| onSelected: () => void; | ||
| }; | ||
|
|
||
| type HeaderWithBackButtonProps = ChildrenProps & { | ||
| /** Title of the Header */ | ||
| title?: string; | ||
|
|
||
| /** Subtitle of the header */ | ||
| subtitle?: ReactNode; | ||
|
|
||
| /** Title color */ | ||
| titleColor?: string; | ||
|
|
||
| /** Method to trigger when pressing download button of the header */ | ||
| onDownloadButtonPress?: () => void; | ||
|
|
||
| /** Method to trigger when pressing close button of the header */ | ||
| onCloseButtonPress?: () => void; | ||
|
|
||
| /** Method to trigger when pressing back button of the header */ | ||
| onBackButtonPress?: () => void; | ||
|
|
||
| /** Method to trigger when pressing more options button of the header */ | ||
| onThreeDotsButtonPress?: () => void; | ||
|
|
||
| /** Whether we should show a border on the bottom of the Header */ | ||
| shouldShowBorderBottom?: boolean; | ||
|
|
||
| /** Whether we should show a download button */ | ||
| shouldShowDownloadButton?: boolean; | ||
|
|
||
| /** Whether we should show a get assistance (question mark) button */ | ||
| shouldShowGetAssistanceButton?: boolean; | ||
|
|
||
| /** Whether we should disable the get assistance button */ | ||
| shouldDisableGetAssistanceButton?: boolean; | ||
|
|
||
| /** Whether we should show a pin button */ | ||
| shouldShowPinButton?: boolean; | ||
|
|
||
| /** Whether we should show a more options (threedots) button */ | ||
| shouldShowThreeDotsButton?: boolean; | ||
|
|
||
| /** Whether we should disable threedots button */ | ||
| shouldDisableThreeDotsButton?: boolean; | ||
|
|
||
| /** List of menu items for more(three dots) menu */ | ||
| threeDotsMenuItems?: ThreeDotsMenuItems[]; | ||
|
|
||
| /** The anchor position of the menu */ | ||
| threeDotsAnchorPosition?: AnchorPosition; | ||
|
|
||
| /** Whether we should show a close button */ | ||
| shouldShowCloseButton?: boolean; | ||
|
|
||
| /** Whether we should show a back button */ | ||
| shouldShowBackButton?: boolean; | ||
|
|
||
| /** The guides call taskID to associate with the get assistance button, if we show it */ | ||
| guidesCallTaskID?: string; | ||
|
|
||
| /** Data to display a step counter in the header */ | ||
| stepCounter?: StepCounterParams; | ||
|
|
||
| /** Whether we should show an avatar */ | ||
| shouldShowAvatarWithDisplay?: boolean; | ||
|
|
||
| /** Parent report, if provided it will override props.report for AvatarWithDisplay */ | ||
| parentReport?: OnyxEntry<Report>; | ||
|
|
||
| /** Report, if we're showing the details for one and using AvatarWithDisplay */ | ||
| report?: OnyxEntry<Report>; | ||
|
|
||
| /** The report's policy, if we're showing the details for a report and need info about it for AvatarWithDisplay */ | ||
| policy?: OnyxEntry<Policy>; | ||
|
|
||
| /** Policies, if we're showing the details for a report and need participant details for AvatarWithDisplay */ | ||
| personalDetails?: OnyxCollection<PersonalDetails>; | ||
|
|
||
| /** Single execution function to prevent concurrent navigation actions */ | ||
| singleExecution?: <T extends unknown[]>(action: Action<T>) => Action<T>; | ||
|
|
||
| /** Whether we should navigate to report page when the route have a topMostReport */ | ||
| shouldNavigateToTopMostReport?: boolean; | ||
|
|
||
| /** The fill color for the icon. Can be hex, rgb, rgba, or valid react-native named color such as 'red' or 'blue'. */ | ||
| iconFill?: string; | ||
|
|
||
| /** Whether the popover menu should overlay the current view */ | ||
| shouldOverlay?: boolean; | ||
|
|
||
| /** Whether we should enable detail page navigation */ | ||
| shouldEnableDetailPageNavigation?: boolean; | ||
| }; | ||
|
|
||
| export default HeaderWithBackButtonProps; |
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.