Files
discord-decomp/modules/app_launcher/native/AppLauncherNavigator.tsx
T
2026-11-01 12:12:55 +02:00

100 lines
5.0 KiB
TypeScript

// Metro module 11255 (f11256).
import _objectWithoutProperties from "../../../_bundle/_objectWithoutProperties";
import { memo, useLayoutEffect } from "react";
import { AppLauncherRouteName } from "./AppLauncherNativeConstants";
import { AnalyticEvents } from "../../../Constants";
import { createNativeStackNavigator } from "../../../_bundle/Module9109";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useAnalyticsLocations, { AnalyticsLocationProvider } from "../../app_analytics/useAnalyticsLocations";
import AnalyticsLocation from "../../app_analytics/AnalyticsLocation";
import { useKeyboardContextForType } from "../../keyboard/native/useKeyboardType";
import { KeyboardTypes } from "../../keyboard/native/KeyboardTypes";
import { useAccessibilityNativeStackOptions } from "../../../design/components/Navigator/native/Navigator.native";
import { trackWithMetadata } from "../../app_analytics/AppAnalyticsUtils";
import { NavigationContainer } from "../../../_bundle/Module1481";
import AppLauncherHomeScreen from "./screens/home/AppLauncherHomeScreen";
import AppLauncherApplicationViewScreen from "./screens/application_view/AppLauncherApplicationViewScreen";
import AppLauncherCommandViewScreen from "./screens/command_view/AppLauncherCommandViewScreen";
import AppLauncherViewAllScreen from "./screens/app_list_view/AppLauncherViewAllScreen";
import { AppLauncherContext } from "./AppLauncherContext";
import { HermesBuiltin } from "../../../_hermes/prelude";
const _excluded = ["initialRouteName"];
const nativeStackNavigator = createNativeStackNavigator();
const useStyles = createStyles({
navigator: {
backgroundColor: Module712.colors.MOBILE_KEYBOARD_PANEL_BACKGROUND,
paddingTop: 16,
overflow: "visible",
flex: 1
}
});
const r44 = memo(function AppLauncherNavigator(props) {
const { bottomSheetExpandReasonRef, bottomSheetIndex, bottomSheetPosition, context, chatInputRef, contentStyle, entrypoint, expandBottomSheet, keyboardCloseReasonRef, onActivityItemSelected, width } = props;
let overrideParams = props.overrideParams;
const analyticsLocations = useAnalyticsLocations(AnalyticsLocation.APP_LAUNCHER).analyticsLocations;
const styles = useStyles();
const keyboardContextForType = useKeyboardContextForType(KeyboardTypes.APP_LAUNCHER);
if (overrideParams == null) {
overrideParams = keyboardContextForType;
}
const accessibilityNativeStackOptions = useAccessibilityNativeStackOptions();
const initialRouteName = overrideParams.initialRouteName;
let r27 = _objectWithoutProperties(overrideParams, _excluded);
useLayoutEffect(() => {
trackWithMetadata(AnalyticEvents.APPLICATION_COMMAND_TOP_OF_FUNNEL, {
location: "app_launcher",
source: entrypoint
});
}, [entrypoint]);
const Navigator = nativeStackNavigator.Navigator;
const screenOptions = {
contentStyle: [styles.navigator, contentStyle],
headerShown: false,
fullScreenGestureEnabled: true,
...accessibilityNativeStackOptions
};
const children = [<nativeStackNavigator.Screen name={AppLauncherRouteName.HOME} component={AppLauncherHomeScreen} initialParams={{
context,
initialSearchQuery: overrideParams.initialRouteName === AppLauncherRouteName.HOME ? overrideParams.initialSearchQuery : void 0
}} />, <nativeStackNavigator.Screen name={AppLauncherRouteName.APPLICATION_VIEW} component={AppLauncherApplicationViewScreen} initialParams={{
context,
...initialRouteName !== AppLauncherRouteName.APPLICATION_VIEW ? {} : r27,
expandBottomSheet
}} />, <nativeStackNavigator.Screen name={AppLauncherRouteName.COMMAND_VIEW} component={AppLauncherCommandViewScreen} initialParams={{
context: context.type === "channel" ? context : void 0,
...overrideParams.initialRouteName !== AppLauncherRouteName.COMMAND_VIEW ? {} : r27,
expandBottomSheet
}} />, ,];
const Screen = nativeStackNavigator.Screen;
const initialParams = {
context
};
if (overrideParams.initialRouteName !== AppLauncherRouteName.APP_LIST_VIEW) {
r27 = {};
}
HermesBuiltin.copyDataProperties(initialParams, r27);
children[3] = <Screen name={AppLauncherRouteName.APP_LIST_VIEW} component={AppLauncherViewAllScreen} initialParams={initialParams} />;
return <AppLauncherContext.Provider value={{
bottomSheetExpandReasonRef,
bottomSheetIndex,
bottomSheetPosition,
chatInputRef,
entrypoint,
entrypointParams: "customId" in overrideParams || "referrerId" in overrideParams ? {
customId: overrideParams.customId,
referrerId: overrideParams.referrerId
} : null,
keyboardCloseReasonRef,
onActivityItemSelected,
width
}}>
<NavigationContainer independent>
<AnalyticsLocationProvider value={analyticsLocations}>
<Navigator initialRouteName={initialRouteName} screenOptions={screenOptions}>{children}</Navigator>
</AnalyticsLocationProvider>
</NavigationContainer>
</AppLauncherContext.Provider>;
});
export default r44;