fix(chat): disable keyboard adaptation in regular browsers
This commit is contained in:
@@ -60,6 +60,14 @@ export function useKeyboardHeight({
|
||||
const environment = getKeyboardAdaptEnvironment();
|
||||
|
||||
log.debug("[keyboard] environment", environment);
|
||||
if (!shouldEnableKeyboardAdaptation(environment)) {
|
||||
resetVars();
|
||||
log.debug("[keyboard] disabled", {
|
||||
reason: "regular-browser",
|
||||
environment,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const apply = () => {
|
||||
rafId = null;
|
||||
@@ -279,6 +287,12 @@ function shouldUseInAppKeyboardFallback(): boolean {
|
||||
return getKeyboardAdaptEnvironment(ua).usesXiaomiFacebookFallback;
|
||||
}
|
||||
|
||||
function shouldEnableKeyboardAdaptation(
|
||||
environment: ReturnType<typeof getKeyboardAdaptEnvironment>,
|
||||
): boolean {
|
||||
return environment.isInAppBrowser;
|
||||
}
|
||||
|
||||
function clamp(value: number, min: number, max: number): number {
|
||||
return Math.min(max, Math.max(min, value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user