41 lines
1.8 KiB
TypeScript
41 lines
1.8 KiB
TypeScript
// Metro module 15992 (f15993).
|
|
import { useContext, useCallback } from "react";
|
|
import { VoicePanelControlsModes } from "./VoicePanelControlsConstants";
|
|
import VoicePanelStateContext from "../VoicePanelStateContext";
|
|
import { useDerivedValue } from "../../../reanimated/ReanimatedRexport";
|
|
import useStateFromSharedValue from "../../../reanimated/native/useStateFromSharedValue";
|
|
import { VoicePanelTabAnalyticsSources } from "./trackVoicePanelTabOpened";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
const __initData = {
|
|
code: "function useDrawerToggleTsx1(){const{controlsSpecs,VoicePanelControlsModes}=this.__closure;return controlsSpecs.get().mode===VoicePanelControlsModes.DRAWER;}"
|
|
};
|
|
export default function useDrawerToggle(a0) {
|
|
const context = useContext(VoicePanelStateContext);
|
|
const { controlsSpecs, connected, dismissPanel } = context;
|
|
const l = () => controlsSpecs.get().mode === VoicePanelControlsModes.DRAWER;
|
|
l.__closure = {
|
|
controlsSpecs,
|
|
VoicePanelControlsModes
|
|
};
|
|
l.__workletHash = 900483810235;
|
|
l.__initData = __initData;
|
|
const stateFromSharedValue = useStateFromSharedValue(useDerivedValue(l));
|
|
const callback = useCallback(() => {
|
|
if (controlsSpecs.get().mode === VoicePanelControlsModes.DRAWER) {
|
|
dismissPanel();
|
|
} else {
|
|
a0({
|
|
tab: "settings",
|
|
source: connected.get() ? VoicePanelTabAnalyticsSources.CONNECTED_BUTTON : VoicePanelTabAnalyticsSources.PREJOIN_BUTTON
|
|
});
|
|
}
|
|
}, [a0, dismissPanel, connected, controlsSpecs]);
|
|
const stateFromSharedValue2 = useStateFromSharedValue(connected);
|
|
return {
|
|
isDrawerOpen: stateFromSharedValue,
|
|
handlePress: callback,
|
|
accessibilityLabel: stateFromSharedValue ? intl.string(t["awDmr/"]) : intl.string(t.OXW7dL),
|
|
ariaHidden: !stateFromSharedValue2
|
|
};
|
|
};
|