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 e9a7bc8b0..532ba8a46 100644 --- a/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.ios.tsx +++ b/apps/mobile/src/lib/navigation/bottom-tab/TabScreen.ios.tsx @@ -18,6 +18,7 @@ export interface TabScreenProps { title: string tabScreenIndex: number renderIcon?: (props: TabbarIconProps) => React.ReactNode + lazy?: boolean } export const TabScreen: FC>> = ({ children, @@ -32,7 +33,8 @@ export const TabScreen: FC { + + const mergedProps = useMemo(() => { const propsFromChildren: Partial = {} if (children && typeof children === "object") { const childType = (children as any).type as TabScreenComponent @@ -42,13 +44,20 @@ export const TabScreen: FC { setTabScreens((prev) => [ ...prev, { - ...propsFromChildren, - ...props, + ...mergedProps, tabScreenIndex, }, ]) @@ -58,7 +67,7 @@ export const TabScreen: FC tabScreen.tabScreenIndex !== tabScreenIndex), ) } - }, [setTabScreens, props, tabScreenIndex, children]) + }, [setTabScreens, props, tabScreenIndex, children, mergedProps]) const currentSelectedIndex = useAtomValue(currentIndexAtom) @@ -87,7 +96,7 @@ export const TabScreen: FC diff --git a/apps/mobile/src/lib/navigation/bottom-tab/types.ts b/apps/mobile/src/lib/navigation/bottom-tab/types.ts index c236e3f06..b657c9cba 100644 --- a/apps/mobile/src/lib/navigation/bottom-tab/types.ts +++ b/apps/mobile/src/lib/navigation/bottom-tab/types.ts @@ -8,4 +8,6 @@ export type TabbarIconProps = { export type TabScreenComponent = FC & { tabBarIcon?: (props: TabbarIconProps) => React.ReactNode title?: string + + lazy?: boolean } diff --git a/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx b/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx index b4a60ec54..ea692de1d 100644 --- a/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx +++ b/apps/mobile/src/screens/(stack)/(tabs)/discover.tsx @@ -40,3 +40,4 @@ DiscoverTabScreen.tabBarIcon = ({ focused, color }) => { } DiscoverTabScreen.title = "Discover" +DiscoverTabScreen.lazy = true