Skip to content

Commit

Permalink
Merge pull request #36770 from ygshbht/fix/address-page-state-navigat…
Browse files Browse the repository at this point in the history
…ion-2

Fix/address page state navigation 2
  • Loading branch information
mountiny committed Apr 2, 2024
2 parents 26a2a8f + 3f87bf2 commit ed59db2
Show file tree
Hide file tree
Showing 17 changed files with 333 additions and 222 deletions.
20 changes: 20 additions & 0 deletions src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,16 @@ const ROUTES = {
route: 'settings/profile/address/country',
getRoute: (country: string, backTo?: string) => getUrlWithBackToParam(`settings/profile/address/country?country=${country}`, backTo),
},
SETTINGS_ADDRESS_STATE: {
route: 'settings/profile/address/state',

getRoute: (state?: string, backTo?: string, label?: string) =>
`${getUrlWithBackToParam(`settings/profile/address/state${state ? `?state=${encodeURIComponent(state)}` : ''}`, backTo)}${
// the label param can be an empty string so we cannot use a nullish ?? operator
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
label ? `${backTo || state ? '&' : '?'}label=${encodeURIComponent(label)}` : ''
}` as const,
},
SETTINGS_CONTACT_METHODS: {
route: 'settings/profile/contact-methods',
getRoute: (backTo?: string) => getUrlWithBackToParam('settings/profile/contact-methods', backTo),
Expand Down Expand Up @@ -401,6 +411,16 @@ const ROUTES = {
`create/${iouType}/start/${transactionID}/${reportID}/scan` as const,
},

MONEY_REQUEST_STATE_SELECTOR: {
route: 'request/state',

getRoute: (state?: string, backTo?: string, label?: string) =>
`${getUrlWithBackToParam(`request/state${state ? `?state=${encodeURIComponent(state)}` : ''}`, backTo)}${
// the label param can be an empty string so we cannot use a nullish ?? operator
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
label ? `${backTo || state ? '&' : '?'}label=${encodeURIComponent(label)}` : ''
}` as const,
},
IOU_REQUEST: 'request/new',
IOU_SEND: 'send/new',
IOU_SEND_ADD_BANK_ACCOUNT: 'send/new/add-bank-account',
Expand Down
2 changes: 2 additions & 0 deletions src/SCREENS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const SCREENS = {
DATE_OF_BIRTH: 'Settings_DateOfBirth',
ADDRESS: 'Settings_Address',
ADDRESS_COUNTRY: 'Settings_Address_Country',
ADDRESS_STATE: 'Settings_Address_State',
},

PREFERENCES: {
Expand Down Expand Up @@ -154,6 +155,7 @@ const SCREENS = {
WAYPOINT: 'Money_Request_Waypoint',
EDIT_WAYPOINT: 'Money_Request_Edit_Waypoint',
RECEIPT: 'Money_Request_Receipt',
STATE_SELECTOR: 'Money_Request_State_Selector',
},

IOU_SEND: {
Expand Down
4 changes: 2 additions & 2 deletions src/components/AddressForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import CountrySelector from './CountrySelector';
import FormProvider from './Form/FormProvider';
import InputWrapper from './Form/InputWrapper';
import type {FormOnyxValues} from './Form/types';
import StatePicker from './StatePicker';
import StateSelector from './StateSelector';
import TextInput from './TextInput';

type CountryZipRegex = {
Expand Down Expand Up @@ -190,7 +190,7 @@ function AddressForm({
{isUSAForm ? (
<View style={styles.mhn5}>
<InputWrapper
InputComponent={StatePicker}
InputComponent={StateSelector}
inputID={INPUT_IDS.STATE}
defaultValue={state}
onValueChange={onAddressChanged}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Form/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import type Picker from '@components/Picker';
import type RadioButtons from '@components/RadioButtons';
import type RoomNameInput from '@components/RoomNameInput';
import type SingleChoiceQuestion from '@components/SingleChoiceQuestion';
import type StatePicker from '@components/StatePicker';
import type StateSelector from '@components/StateSelector';
import type TextInput from '@components/TextInput';
import type TextPicker from '@components/TextPicker';
import type ValuePicker from '@components/ValuePicker';
Expand All @@ -40,7 +40,7 @@ type ValidInputs =
| typeof CountrySelector
| typeof AmountForm
| typeof BusinessTypePicker
| typeof StatePicker
| typeof StateSelector
| typeof RoomNameInput
| typeof ValuePicker
| typeof DatePicker
Expand Down
114 changes: 0 additions & 114 deletions src/components/StatePicker/StateSelectorModal.tsx

This file was deleted.

93 changes: 0 additions & 93 deletions src/components/StatePicker/index.tsx

This file was deleted.

Loading

0 comments on commit ed59db2

Please sign in to comment.