-
Notifications
You must be signed in to change notification settings - Fork 3k
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 #42697 from Expensify/revert-41970-travel/address-…
…page-refactor [CP Staging] Revert "[Travel] [Refactor] Create a new shared component for AddressPage"
- Loading branch information
Showing
9 changed files
with
182 additions
and
153 deletions.
There are no files selected for viewing
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 was deleted.
Oops, something went wrong.
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,23 @@ | ||
import {useRoute} from '@react-navigation/native'; | ||
import type {ParamListBase, RouteProp} from '@react-navigation/native'; | ||
import {CONST as COMMON_CONST} from 'expensify-common/lib/CONST'; | ||
|
||
type CustomParamList = ParamListBase & Record<string, Record<string, string>>; | ||
type State = keyof typeof COMMON_CONST.STATES; | ||
|
||
/** | ||
* Extracts the 'state' (default) query parameter from the route/ url and validates it against COMMON_CONST.STATES, returning its ISO code or `undefined`. | ||
* Example 1: Url: https://new.expensify.com/settings/profile/address?state=MO Returns: MO | ||
* Example 2: Url: https://new.expensify.com/settings/profile/address?state=ASDF Returns: undefined | ||
* Example 3: Url: https://new.expensify.com/settings/profile/address Returns: undefined | ||
* Example 4: Url: https://new.expensify.com/settings/profile/address?state=MO-hash-a12341 Returns: MO | ||
*/ | ||
export default function useGeographicalStateFromRoute(stateParamName = 'state'): State | undefined { | ||
const route = useRoute<RouteProp<CustomParamList, string>>(); | ||
const stateFromUrlTemp = route.params?.[stateParamName] as string | undefined; | ||
|
||
if (!stateFromUrlTemp) { | ||
return; | ||
} | ||
return COMMON_CONST.STATES[stateFromUrlTemp as State]?.stateISO; | ||
} |
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
61 changes: 0 additions & 61 deletions
61
src/pages/settings/Profile/PersonalDetails/PersonalAddressPage.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.