64 lines
2.7 KiB
TypeScript
64 lines
2.7 KiB
TypeScript
// Metro module 15590 (f15591).
|
|
import { useRef, useMemo, useState } from "react";
|
|
import { AppLauncherRouteName } from "./AppLauncherNativeConstants";
|
|
import { useSharedValue } from "../../reanimated/ReanimatedRexport";
|
|
import { AppLauncherKeyboardCloseReason } from "./AppLauncherContext";
|
|
import { AppLauncherEntrypoint } from "../AppLauncherTypes";
|
|
import { useDefaultAppLauncherWidth } from "./hooks/useDefaultAppLauncherWidth";
|
|
import { BottomSheet } from "../../../design/components/Sheet/native/BottomSheet.native";
|
|
import AppLauncherNavigator from "./AppLauncherNavigator";
|
|
import { getAppDMApplication } from "../../app_dms/getAppDMApplication";
|
|
import ActionSheetContext from "../../action_sheet/native/ActionSheetContext";
|
|
const AppLauncherActionSheet = function AppLauncherActionSheet(props) {
|
|
const { chatInputRef, channel } = props;
|
|
const ref = useRef(null);
|
|
const sharedValue2 = useSharedValue(-1);
|
|
const sharedValue = useSharedValue(0);
|
|
const ref3 = useRef(void 0);
|
|
const ref2 = useRef(AppLauncherKeyboardCloseReason.DISMISSED);
|
|
const TEXT = AppLauncherEntrypoint.TEXT;
|
|
const defaultAppLauncherWidth = useDefaultAppLauncherWidth(TEXT);
|
|
return <BottomSheet ref={ref} animatedIndex={sharedValue2} scrollable startExpanded>
|
|
<AppLauncherNavigator bottomSheetIndex={sharedValue2} bottomSheetPosition={sharedValue} bottomSheetExpandReasonRef={ref3} context={useMemo(() => ({
|
|
channel,
|
|
type: "channel"
|
|
}), [channel])} chatInputRef={useRef({
|
|
getApplicationCommandManager: () => {
|
|
const current = chatInputRef.current;
|
|
return current == null ? void 0 : current.getApplicationCommandManager();
|
|
},
|
|
closeCustomKeyboard: () => {
|
|
const current = ref.current;
|
|
if (current != null) {
|
|
current.closeActionSheet();
|
|
}
|
|
},
|
|
openCustomKeyboard: () => {
|
|
const current = ref.current;
|
|
if (current != null) {
|
|
current.expandActionSheet();
|
|
}
|
|
}
|
|
})} entrypoint={TEXT} keyboardCloseReasonRef={ref2} width={defaultAppLauncherWidth} overrideParams={{
|
|
initialRouteName: AppLauncherRouteName.HOME,
|
|
initialSearchQuery: getAppDMApplication(channel)?.name
|
|
}} />
|
|
</BottomSheet>;
|
|
};
|
|
export function useAppLauncherActionSheet(a0) {
|
|
const [state, setState] = useState(false);
|
|
return {
|
|
appLauncherActionSheet: useMemo(() => state ? <ActionSheetContext.Provider value={{
|
|
transitionState: "visible",
|
|
close: () => {},
|
|
onLeave: () => {
|
|
setState(false);
|
|
},
|
|
registerDismissHandler: () => {}
|
|
}}>
|
|
<AppLauncherActionSheet {...a0} />
|
|
</ActionSheetContext.Provider> : null, [state, a0]),
|
|
setAppLauncherActionSheetEnabled: setState
|
|
};
|
|
}
|