diff --git a/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.ios.tsx b/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.ios.tsx index 83bd59287..099dd8f8b 100644 --- a/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.ios.tsx +++ b/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.ios.tsx @@ -8,8 +8,8 @@ import { StyleSheet } from "react-native" import type { BottomTabContextType } from "./BottomTabContext" import { BottomTabContext } from "./BottomTabContext" -import type { TabScreenProps } from "./TabScreen.ios" import { TabScreen } from "./TabScreen.ios" +import type { TabScreenProps } from "./types" interface TabRootProps { initialTabIndex?: number diff --git a/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.tsx b/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.tsx index 96bc89b5c..6be3ddae4 100644 --- a/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.tsx +++ b/apps/mobile/src/lib/navigation/bottom-tab/TabRoot.tsx @@ -6,8 +6,8 @@ import { StyleSheet, View } from "react-native" import type { BottomTabContextType } from "./BottomTabContext" import { BottomTabContext } from "./BottomTabContext" -import type { TabScreenProps } from "./TabScreen" import { TabScreen } from "./TabScreen" +import type { TabScreenProps } from "./types" interface TabRootProps { initialTabIndex?: number diff --git a/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.ios.tsx b/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.ios.tsx index 532ba8a46..c128a9bc5 100644 --- a/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.ios.tsx +++ b/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.ios.tsx @@ -10,16 +10,10 @@ import { BottomTabContext } from "./BottomTabContext" import { LifecycleEvents, ScreenNameRegister } from "./shared" import type { TabScreenContextType } from "./TabScreenContext" import { TabScreenContext } from "./TabScreenContext" -import type { TabbarIconProps, TabScreenComponent } from "./types" +import type { TabScreenComponent, TabScreenProps } from "./types" const TabScreenNative = requireNativeView("TabScreen") -export interface TabScreenProps { - title: string - tabScreenIndex: number - renderIcon?: (props: TabbarIconProps) => React.ReactNode - lazy?: boolean -} export const TabScreen: FC>> = ({ children, ...props @@ -47,6 +41,9 @@ export const TabScreen: FC( () => ({ tabScreenIndex, - + identifierAtom: atom(props.identifier ?? ""), titleAtom: atom(props.title), }), - [tabScreenIndex, props.title], + [tabScreenIndex, props.title, props.identifier], ) const shouldLoadReact = mergedProps.lazy ? isSelected || isLoadedBefore : true diff --git a/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.tsx b/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.tsx index d3e35b611..7bafb0616 100644 --- a/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.tsx +++ b/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.tsx @@ -8,14 +8,8 @@ import { BottomTabContext } from "./BottomTabContext" import { LifecycleEvents, ScreenNameRegister, TabScreenIdentifierRegister } from "./shared" import type { TabScreenContextType } from "./TabScreenContext" import { TabScreenContext } from "./TabScreenContext" -import type { TabbarIconProps, TabScreenComponent } from "./types" +import type { TabScreenComponent, TabScreenProps } from "./types" -export interface TabScreenProps { - title: string - tabScreenIndex: number - identifier: string - renderIcon?: (props: TabbarIconProps) => React.ReactNode -} export const TabScreen: FC>> = ({ children, identifier, @@ -85,7 +79,7 @@ export const TabScreen: FC ({ tabScreenIndex, titleAtom: atom(props.title), - identifierAtom: atom(identifier), + identifierAtom: atom(identifier ?? ""), }), [tabScreenIndex, props.title, identifier], ) diff --git a/apps/mobile/src/lib/navigation/bottom-tab/types.ts b/apps/mobile/src/lib/navigation/bottom-tab/types.ts index b657c9cba..54826cdb4 100644 --- a/apps/mobile/src/lib/navigation/bottom-tab/types.ts +++ b/apps/mobile/src/lib/navigation/bottom-tab/types.ts @@ -11,3 +11,10 @@ export type TabScreenComponent = FC & { lazy?: boolean } +export interface TabScreenProps { + title: string + tabScreenIndex: number + renderIcon?: (props: TabbarIconProps) => React.ReactNode + lazy?: boolean + identifier?: string +}