fix(chat): scope keyboard avoidance to Facebook IAB
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
export const CHAT_KEYBOARD_VISIBLE_THRESHOLD_PX = 80;
|
||||
export const CHAT_KEYBOARD_ZOOM_THRESHOLD = 1.05;
|
||||
export const CHAT_KEYBOARD_TARGET_GAP_PX = 8;
|
||||
export const CHAT_KEYBOARD_FALLBACK_RATIO = 0.42;
|
||||
export const CHAT_KEYBOARD_FALLBACK_MIN_PX = 260;
|
||||
export const CHAT_KEYBOARD_FALLBACK_MAX_PX = 380;
|
||||
@@ -67,7 +68,10 @@ export function resolveChatKeyboardInset(
|
||||
|
||||
return {
|
||||
keyboardVisible: true,
|
||||
bottomInset: Math.min(maxInset, Math.round(occludedHeight)),
|
||||
bottomInset: Math.min(
|
||||
maxInset,
|
||||
Math.round(occludedHeight + CHAT_KEYBOARD_TARGET_GAP_PX),
|
||||
),
|
||||
source:
|
||||
virtualKeyboardHeight >= visualViewportHeight
|
||||
? "virtual-keyboard"
|
||||
@@ -78,11 +82,13 @@ export function resolveChatKeyboardInset(
|
||||
export function resolveChatKeyboardFallbackInset(
|
||||
layoutHeight: number,
|
||||
): number {
|
||||
return Math.min(
|
||||
const estimatedKeyboardHeight = Math.min(
|
||||
CHAT_KEYBOARD_FALLBACK_MAX_PX,
|
||||
Math.max(
|
||||
CHAT_KEYBOARD_FALLBACK_MIN_PX,
|
||||
Math.round(layoutHeight * CHAT_KEYBOARD_FALLBACK_RATIO),
|
||||
),
|
||||
);
|
||||
|
||||
return estimatedKeyboardHeight + CHAT_KEYBOARD_TARGET_GAP_PX;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user