diff --git a/src/components/FullPageWebView/FullPageWebViewHeader.tsx b/src/components/FullPageWebView/FullPageWebViewHeader.tsx index a2e69d48d..1a5e02ada 100644 --- a/src/components/FullPageWebView/FullPageWebViewHeader.tsx +++ b/src/components/FullPageWebView/FullPageWebViewHeader.tsx @@ -8,9 +8,10 @@ import { useSafeAreaInsets } from "react-native-safe-area-context"; import { dropShadow } from "styles/global"; type HeaderTitle = string | ( ( props: HeaderTitleProps ) => React.ReactNode ) | undefined; -type Props = { + +interface Props { route: { - name: string + name: string; }; options: { title?: string | undefined; @@ -18,16 +19,16 @@ type Props = { headerStyle?: object; headerShadowVisible?: boolean; }; -}; +} const HEADER_STYLE = { backgroundColor: "white" -}; +} as const; const BACK_BUTTON_STYLE = { position: "relative", start: 11 -}; +} as const; const FullPageWebViewHeader = ( { route, diff --git a/src/navigation/StackNavigators/LoginStackNavigator.js b/src/navigation/StackNavigators/LoginStackNavigator.js index e6b1ff6f3..4034e73e3 100644 --- a/src/navigation/StackNavigators/LoginStackNavigator.js +++ b/src/navigation/StackNavigators/LoginStackNavigator.js @@ -12,7 +12,7 @@ import { CloseButton } from "components/SharedComponents"; import { hideHeaderLeft, showSimpleCustomHeader -} from "navigation/navigationOptions"; +} from "navigation/navigationOptions.tsx"; import type { Node } from "react"; import React from "react"; diff --git a/src/navigation/StackNavigators/NoBottomTabStackNavigator.js b/src/navigation/StackNavigators/NoBottomTabStackNavigator.js index a6133bc2c..993f4e454 100644 --- a/src/navigation/StackNavigators/NoBottomTabStackNavigator.js +++ b/src/navigation/StackNavigators/NoBottomTabStackNavigator.js @@ -21,7 +21,7 @@ import { fadeInComponent, hideHeader, hideHeaderLeft -} from "navigation/navigationOptions"; +} from "navigation/navigationOptions.tsx"; import type { Node } from "react"; import React from "react"; diff --git a/src/navigation/StackNavigators/SharedStackScreens.js b/src/navigation/StackNavigators/SharedStackScreens.js index 3e71c2e0f..7b0fb3df9 100644 --- a/src/navigation/StackNavigators/SharedStackScreens.js +++ b/src/navigation/StackNavigators/SharedStackScreens.js @@ -20,7 +20,7 @@ import { removeBottomBorder, showHeader, showSimpleCustomHeader -} from "navigation/navigationOptions"; +} from "navigation/navigationOptions.tsx"; import type { Node } from "react"; import React from "react"; diff --git a/src/navigation/StackNavigators/TabStackNavigator.js b/src/navigation/StackNavigators/TabStackNavigator.js index 278e452f9..e27cce108 100644 --- a/src/navigation/StackNavigators/TabStackNavigator.js +++ b/src/navigation/StackNavigators/TabStackNavigator.js @@ -43,7 +43,7 @@ import { removeBottomBorder, showHeader, showLongHeader -} from "navigation/navigationOptions"; +} from "navigation/navigationOptions.tsx"; import type { Node } from "react"; import React from "react"; import { diff --git a/src/navigation/navigationOptions.js b/src/navigation/navigationOptions.tsx similarity index 86% rename from src/navigation/navigationOptions.js rename to src/navigation/navigationOptions.tsx index e17a66a89..decbf6163 100644 --- a/src/navigation/navigationOptions.js +++ b/src/navigation/navigationOptions.tsx @@ -1,30 +1,27 @@ -// @flow import { HeaderBackground } from "@react-navigation/elements"; import { fontMedium } from "appConstants/fontFamilies.ts"; import FullPageWebViewHeader from "components/FullPageWebView/FullPageWebViewHeader.tsx"; import BackButton from "components/SharedComponents/Buttons/BackButton"; -import type { Node } from "react"; import React from "react"; import { View } from "react-native"; import colors from "styles/tailwindColors"; import FadeInView from "./FadeInView"; -// $FlowIgnore const fadeInComponent = ( component: React.JSX.Element ): React.JSX.Element => ( {component} ); -const baseHeaderOptions: Object = { +const baseHeaderOptions = { headerShown: true, headerBackButtonDisplayMode: "minimal", headerShadowVisible: false, headerLeft: () => -}; +} as const; -const showHeader: Object = { +const showHeader = { ...baseHeaderOptions, headerTintColor: colors.darkGray, // Note: left header is not supported on iOS @@ -34,9 +31,9 @@ const showHeader: Object = { fontSize: 24, fontFamily: fontMedium } -}; +} as const; -const showLongHeader: Object = { +const showLongHeader = { ...baseHeaderOptions, headerTintColor: colors.darkGray, // Note: left header is not supported on iOS @@ -46,48 +43,48 @@ const showLongHeader: Object = { fontSize: 16, fontFamily: fontMedium } -}; +} as const; -export const hideHeaderLeft: Object = { +export const hideHeaderLeft = { ...showHeader, headerLeft: null, headerBackVisible: false -}; +} as const; -const showSimpleCustomHeader: Object = { +const showSimpleCustomHeader = { header: FullPageWebViewHeader, headerShadowVisible: true -}; +} as const; const hideHeader = { headerShown: false -}; +} as const; const blankHeaderTitle = { headerTitle: "" -}; +} as const; const removeBottomBorder = { - headerBackground: ( ): Node => ( + headerBackground: ( ) => ( // eslint-disable-next-line react-native/no-inline-styles ) -}; +} as const; // this removes the default hamburger menu from header const hideDrawerHeaderLeft = { - headerLeft: ( ): Node => ( + headerLeft: ( ) => ( ) -}; +} as const; const preventSwipeToGoBack = { gestureEnabled: false -}; +} as const; const isDrawerScreen = { animation: "none" -}; +} as const; export { blankHeaderTitle, diff --git a/src/navigation/rootDrawerNavigator.js b/src/navigation/rootDrawerNavigator.js index 91ce4a9d8..a585e410d 100644 --- a/src/navigation/rootDrawerNavigator.js +++ b/src/navigation/rootDrawerNavigator.js @@ -3,7 +3,7 @@ import { createDrawerNavigator } from "@react-navigation/drawer"; import { hideDrawerHeaderLeft, hideHeader -} from "navigation/navigationOptions"; +} from "navigation/navigationOptions.tsx"; import LoginStackNavigator from "navigation/StackNavigators/LoginStackNavigator"; import NoBottomTabStackNavigator from "navigation/StackNavigators/NoBottomTabStackNavigator"; import OnboardingStackNavigator from "navigation/StackNavigators/OnboardingStackNavigator";