fix(mobile): add iOS keyboard home indicator safe area (#141)
On iOS devices, when the keyboard is open, there's a home indicator bar (approximately 34px tall) at the bottom of the keyboard that needs additional safe area padding. Changes: - Add --oc-keyboard-home-indicator CSS variable - Add ios-keyboard-safe-area class for keyboard open state - Detect iOS userAgent and set keyboard home indicator height - Apply ios-keyboard-safe-area class to ChatInput when keyboard is open Co-authored-by: Jovines <jovines@qq.com>
This commit is contained in:
committed by
GitHub
co-authored by
Jovines
parent
c4fb9d5730
commit
4fa4c8d40b
@@ -201,6 +201,10 @@ export const MainLayout: React.FC = () => {
|
||||
root.style.setProperty('--oc-keyboard-inset', `${stickyKeyboardInset}px`);
|
||||
previousHeight = height;
|
||||
|
||||
const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
||||
const keyboardHomeIndicator = isIOS && stickyKeyboardInset > 0 ? 34 : 0;
|
||||
root.style.setProperty('--oc-keyboard-home-indicator', `${keyboardHomeIndicator}px`);
|
||||
|
||||
const avoidTarget = isTextTarget ? resolveKeyboardAvoidTarget(active) : null;
|
||||
|
||||
if (!isMobile || !avoidTarget || !active) {
|
||||
|
||||
Reference in New Issue
Block a user