Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

pendingUserInputLayout.ts

28 lines886 Bytes

1const PENDING_USER_INPUT_MAX_HEIGHT = 560;
2const PENDING_USER_INPUT_MIN_HEIGHT = 160;
3const PENDING_USER_INPUT_VERTICAL_GAP = 12;
4​
5export const ESTIMATED_KEYBOARD_HEIGHT = 336;
6​
7/** Card transitions and feed insets must share timing to avoid drift. */
8export const USER_INPUT_TOGGLE_DURATION_MS = 220;
9​
10export function derivePendingUserInputMaxHeight(input: {
11 readonly windowHeight: number;
12 readonly keyboardHeight: number;
13 readonly navigationHeaderHeight: number;
14 readonly composerOverlapHeight: number;
15}): number {
16 "worklet";
17 const availableHeight =
18 input.windowHeight -
19 Math.max(0, input.keyboardHeight) -
20 Math.max(0, input.navigationHeaderHeight) -
21 Math.max(0, input.composerOverlapHeight) -
22 PENDING_USER_INPUT_VERTICAL_GAP;
23​
24 return Math.min(
25 PENDING_USER_INPUT_MAX_HEIGHT,
26 Math.max(PENDING_USER_INPUT_MIN_HEIGHT, availableHeight),
27 );