Skip to content

Instantly share code, notes, and snippets.

@amadeus
Created June 14, 2023 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amadeus/e7e0d1659c0f832dd5ed077ab0d1d719 to your computer and use it in GitHub Desktop.
Save amadeus/e7e0d1659c0f832dd5ed077ab0d1d719 to your computer and use it in GitHub Desktop.
diff --git a/discord_app/modules/voice_panel/native/controls/VoicePanelControls.tsx b/discord_app/modules/voice_panel/native/controls/VoicePanelControls.tsx
index 47b462d2900..7430848a2b7 100644
--- a/discord_app/modules/voice_panel/native/controls/VoicePanelControls.tsx
+++ b/discord_app/modules/voice_panel/native/controls/VoicePanelControls.tsx
@@ -279,7 +279,7 @@ function useControlsGesture(
...wrapperSpecs.value,
x: 0,
y: 0,
- width: windowDimensions.value.width,
+ width: getMaxDrawerWidth(windowDimensions.value.width),
height: Math.min(newHeight, wrapperDimensions.value.height - PANEL_HEADER_HEIGHT),
drawerMode: true,
};
@@ -508,6 +508,11 @@ function renderButton(
const MemoedControlsDrawerContainer = React.memo(ControlsDrawerContainer);
+function getMaxDrawerWidth(width: number) {
+ 'worklet';
+ return Math.min(width, CONTROLS_MAX_WIDTH);
+}
+
interface AnimatedReactionProps {
currentControlsMode: VoicePanelControlsModes;
mode: VoicePanelModes;
@@ -568,7 +573,7 @@ function VoicePanelControls() {
}, [setTab, setControlsMode, setPanelStickyPoint, isTextInVoice]);
const wrapperSpecs = useSharedValue<VoicePanelControlsWrapperSpecs>({
- width: Math.min(windowDimensions.value.width - EDGE_GUTTER * 2, CONTROLS_MAX_WIDTH),
+ width: getMaxDrawerWidth(windowDimensions.value.width - EDGE_GUTTER * 2),
height: controlsHeight.value,
x: 0,
y: controlsHeight.value,
@@ -675,7 +680,7 @@ function VoicePanelControls() {
wrapperSpecs.value = {
x: 0,
y: 0,
- width: windowWidth,
+ width: getMaxDrawerWidth(windowWidth),
height,
drawerMode: true,
hidden: false,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment