122 lines
5.7 KiB
TypeScript
122 lines
5.7 KiB
TypeScript
// Metro module 16027 (f16028).
|
|
import * as Module19 from "react";
|
|
import { useState, useRef, useEffect, useMemo, useContext, useCallback } from "react";
|
|
import { StyleSheet, View } from "react-native";
|
|
import { MODE_CHANGE_PHYSICS, VoicePanelModes } from "../../VoicePanelConstants";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import useRefValue from "../../../../hooks/useRefValue";
|
|
import { Freeze } from "../../../../_bundle/Suspender";
|
|
import VoicePanelChatView from "./VoicePanelChatView";
|
|
import VoicePanelStateContext from "../VoicePanelStateContext";
|
|
import * as _ReanimatedRexport from "../../../reanimated/ReanimatedRexport";
|
|
import ReanimatedRexport, { useAnimatedStyle, useAnimatedReaction } from "../../../reanimated/ReanimatedRexport";
|
|
import * as _VoicePanelControlsUtils from "../utils/VoicePanelControlsUtils";
|
|
import * as _spring from "../../../../design/animation/reanimated/spring/spring";
|
|
import * as _cheapWorkletShallowEqual from "../../../reanimated/native/cheapWorkletShallowEqual";
|
|
import VoicePanelVoiceControls from "./VoicePanelVoiceControls";
|
|
import VoicePanelControlsAppLauncher from "./VoicePanelControlsAppLauncher";
|
|
let useStyles, Component, __initData, __initData2, __initData3;
|
|
const renderChat = function renderChat(a0) {
|
|
return <View collapsable={false} style={StyleSheet.absoluteFill}>
|
|
<VoicePanelChatView shown={a0} />
|
|
</View>;
|
|
};
|
|
useStyles = createStyles({
|
|
drawer: {
|
|
flex: 1,
|
|
zIndex: 1,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWER
|
|
}
|
|
});
|
|
Component = Module19.memo(function({ shown, renderContent }) {
|
|
const [freeze, setState] = useState(!shown);
|
|
if (shown ? freeze : shown) {
|
|
setState(false);
|
|
}
|
|
const ref = useRef(shown);
|
|
useEffect(() => {
|
|
ref.current = ref.current || shown;
|
|
});
|
|
useEffect(() => {
|
|
if (!shown) {
|
|
setState(true);
|
|
}
|
|
}, [shown]);
|
|
const memo = useMemo(() => renderContent(shown), [renderContent, shown]);
|
|
return useRefValue(ref) ? <Freeze freeze={freeze}>{memo}</Freeze> : shown ? <Freeze freeze={freeze}>{memo}</Freeze> : null;
|
|
});
|
|
__initData = {
|
|
code: "function VoicePanelControlsDrawerTsx1(){const{getControlsDrawerOpenWidth,windowDimensions,safeArea,withSpring,wrapperSpecs,TRANSITIONAL_HEIGHT,MODE_CHANGE_PHYSICS}=this.__closure;return{width:getControlsDrawerOpenWidth(windowDimensions.get().width,safeArea.get().left,safeArea.get().right),opacity:withSpring(wrapperSpecs.get().height>=TRANSITIONAL_HEIGHT?1:0,MODE_CHANGE_PHYSICS)};}"
|
|
};
|
|
__initData2 = {
|
|
code: "function VoicePanelControlsDrawerTsx2(){const{wrapperSpecs,mode}=this.__closure;return[wrapperSpecs.get().drawerMode,mode.get()];}"
|
|
};
|
|
__initData3 = {
|
|
code: "function VoicePanelControlsDrawerTsx3(props,previous){const{cheapWorkletArrayShallowEqual,VoicePanelModes,runOnJS,setFreeze}=this.__closure;if(cheapWorkletArrayShallowEqual(props,previous!==null&&previous!==void 0?previous:undefined))return;const[isDrawer,mode]=props;if(previous!=null&&isDrawer===previous[0]&&mode===previous[1]){return;}if(mode!==VoicePanelModes.PANEL||!isDrawer){runOnJS(setFreeze)(true);}else{runOnJS(setFreeze)(false);}}"
|
|
};
|
|
const r48 = Module19.memo(function VoicePanelControlsDrawer(props) {
|
|
const { tab, sharedTab, wrapperSpecs, gestureSpecs, openTab } = props;
|
|
const context = useContext(VoicePanelStateContext);
|
|
const { mode, windowDimensions, safeArea } = context;
|
|
const styles = useStyles();
|
|
const [state, setState2] = useState(tab == null);
|
|
if (tab !== sharedTab.get() && state) {
|
|
setState2(false);
|
|
}
|
|
const b = () => ({
|
|
width: _VoicePanelControlsUtils.getControlsDrawerOpenWidth(windowDimensions.get().width, safeArea.get().left, safeArea.get().right),
|
|
opacity: _spring.withSpring(wrapperSpecs.get().height >= 200 ? 1 : 0, MODE_CHANGE_PHYSICS)
|
|
});
|
|
b.__closure = {
|
|
getControlsDrawerOpenWidth: _VoicePanelControlsUtils.getControlsDrawerOpenWidth,
|
|
windowDimensions,
|
|
safeArea,
|
|
withSpring: _spring.withSpring,
|
|
wrapperSpecs,
|
|
TRANSITIONAL_HEIGHT: 200,
|
|
MODE_CHANGE_PHYSICS
|
|
};
|
|
b.__workletHash = 8777106499672;
|
|
b.__initData = __initData;
|
|
const animatedStyle = useAnimatedStyle(b);
|
|
const V = () => [wrapperSpecs.get().drawerMode, mode.get()];
|
|
V.__closure = {
|
|
wrapperSpecs,
|
|
mode
|
|
};
|
|
V.__workletHash = 16802013961309;
|
|
V.__initData = __initData2;
|
|
const M = function M(a0, a1) {
|
|
const r12 = a1 == null ? void 0 : a1;
|
|
L12: {
|
|
if (!_cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual(a0, r12)) {
|
|
const [r16, r17] = a0;
|
|
if (!(a1 != null && r16 === a1[0] && r17 === a1[1])) {
|
|
if (r17 === VoicePanelModes.PANEL && r16) {
|
|
_ReanimatedRexport.runOnJS(setState2)(false);
|
|
break L12;
|
|
}
|
|
_ReanimatedRexport.runOnJS(setState2)(true);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
M.__closure = {
|
|
cheapWorkletArrayShallowEqual: _cheapWorkletShallowEqual.cheapWorkletArrayShallowEqual,
|
|
VoicePanelModes,
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
setFreeze: setState2
|
|
};
|
|
M.__workletHash = 10375596551326;
|
|
M.__initData = __initData3;
|
|
useAnimatedReaction(V, M);
|
|
return <ReanimatedRexport.View style={[styles.drawer, animatedStyle]}>
|
|
<Component shown={state ? !state : tab === "chat"} renderContent={renderChat} />
|
|
<Component shown={state ? !state : tab === "settings"} renderContent={useCallback((a0) => <VoicePanelVoiceControls isVisible={a0} openTab={openTab} />, [openTab])} />
|
|
<Component shown={state ? !state : tab === "app_launcher"} renderContent={useCallback(() => <VoicePanelControlsAppLauncher gestureSpecs={gestureSpecs} />, [gestureSpecs])} />
|
|
</ReanimatedRexport.View>;
|
|
});
|
|
export default r48;
|
|
export { Component as LazyContentFreezer };
|