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

[TS migration] Migrate 'SettingsInitial' page to TypeScript #36415

Merged
Merged
Show file tree
Hide file tree
Changes from 7 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
3 changes: 1 addition & 2 deletions src/libs/UserUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import type {ValueOf} from 'type-fest';
import * as defaultAvatars from '@components/Icon/DefaultAvatars';
import {ConciergeAvatar, FallbackAvatar} from '@components/Icon/Expensicons';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {LoginList, PersonalDetailsList} from '@src/types/onyx';
import type {LoginList} from '@src/types/onyx';
import type Login from '@src/types/onyx/Login';
import type IconAsset from '@src/types/utils/IconAsset';
import hashCode from './hashCode';
Expand Down
6 changes: 5 additions & 1 deletion src/pages/settings/InitialSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type InitialSettingsPageOnyxProps = {
};

type InitialSettingsPageProps = InitialSettingsPageOnyxProps & WithCurrentUserPersonalDetailsProps;

type MenuData = {
kubabutkiewicz marked this conversation as resolved.
Show resolved Hide resolved
translationKey: TranslationPaths;
icon: IconAsset;
Expand All @@ -80,6 +81,7 @@ type MenuData = {
shouldShowRightIcon?: boolean;
iconRight?: IconAsset;
};

type Menu = {sectionStyle: StyleProp<ViewStyle>; sectionTranslationKey: TranslationPaths; items: MenuData[]};
kubabutkiewicz marked this conversation as resolved.
Show resolved Hide resolved

function InitialSettingsPage({session, userWallet, bankAccountList, fundList, walletTerms, loginList, currentUserPersonalDetails}: InitialSettingsPageProps) {
Expand Down Expand Up @@ -184,7 +186,9 @@ function InitialSettingsPage({session, userWallet, bankAccountList, fundList, wa
icon: Expensicons.RotateLeft,
shouldShowRightIcon: true,
iconRight: Expensicons.NewWindow,
action: () => NativeModules.HybridAppModule.closeReactNativeApp() as void,
action: () => {
NativeModules.HybridAppModule.closeReactNativeApp();
},
},
...defaultMenu.items,
].filter((item) => item.translationKey !== 'initialSettingsPage.signOut' && item.translationKey !== 'initialSettingsPage.goToExpensifyClassic');
Expand Down
5 changes: 5 additions & 0 deletions src/types/modules/react-native.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import type {CSSProperties, FocusEventHandler, KeyboardEventHandler, MouseEventH
import 'react-native';
import type {BootSplashModule} from '@libs/BootSplash/types';

interface HybridAppModule {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change interface to type

closeReactNativeApp: () => void;
}

declare module 'react-native' {
// <------ REACT NATIVE WEB (0.19.0) ------>
// Extracted from react-native-web, packages/react-native-web/src/exports/View/types.js
Expand Down Expand Up @@ -351,5 +355,6 @@ declare module 'react-native' {

interface NativeModulesStatic {
BootSplash: BootSplashModule;
HybridAppModule: HybridAppModule;
}
}
Loading