From aeff7f727b7222523841f4541ae6198df034a040 Mon Sep 17 00:00:00 2001 From: Jinjing <6427696+AmethystLiang@users.noreply.github.com> Date: Tue, 1 Sep 2026 00:05:08 -0700 Subject: [PATCH] Remove SearchWorkspacesFab component Consolidates search functionality into bottom-left floating action button as part of mobile search button repositioning. --- mobile/src/components/SearchWorkspacesFab.tsx | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mobile/src/components/SearchWorkspacesFab.tsx b/mobile/src/components/SearchWorkspacesFab.tsx index 4c669f073cc..99f6683d405 100644 --- a/mobile/src/components/SearchWorkspacesFab.tsx +++ b/mobile/src/components/SearchWorkspacesFab.tsx @@ -1,8 +1,9 @@ -import { Keyboard, Pressable, StyleSheet } from 'react-native' +import { Keyboard, Platform, Pressable, StyleSheet } from 'react-native' import { useEffect, useState } from 'react' import { useSafeAreaInsets } from 'react-native-safe-area-context' import { Search, X } from 'lucide-react-native' import { colors, spacing } from '../theme/mobile-theme' +import { resolveBottomDrawerKeyboardInset } from './bottom-drawer-keyboard-inset' import { FAB_SIZE } from './NewWorkspaceFab' type SearchWorkspacesFabProps = { @@ -19,21 +20,32 @@ export function SearchWorkspacesFab({ const [keyboardHeight, setKeyboardHeight] = useState(0) useEffect(() => { - const showSubscription = Keyboard.addListener('keyboardDidShow', ({ endCoordinates }) => { + // Why: iOS fires willShow before the animation, so the FAB rides the keyboard up instead of popping in late. + const showEvent = Platform.OS === 'ios' ? 'keyboardWillShow' : 'keyboardDidShow' + const hideEvent = Platform.OS === 'ios' ? 'keyboardWillHide' : 'keyboardDidHide' + const showSubscription = Keyboard.addListener(showEvent, ({ endCoordinates }) => { setKeyboardHeight(endCoordinates.height) }) - const hideSubscription = Keyboard.addListener('keyboardDidHide', () => setKeyboardHeight(0)) + const hideSubscription = Keyboard.addListener(hideEvent, () => setKeyboardHeight(0)) return () => { showSubscription.remove() hideSubscription.remove() } }, []) + // Why: the FAB already offsets by insets.bottom, which the iOS keyboard frame also covers. + const keyboardLift = resolveBottomDrawerKeyboardInset({ + keyboardHeight, + bottomInset: insets.bottom, + fillAvailable: false, + platform: Platform.OS + }) + return ( [ styles.fab, - { bottom: spacing.xl + insets.bottom + keyboardHeight }, + { bottom: spacing.xl + insets.bottom + keyboardLift }, pressed && styles.fabPressed ]} onPress={onPress}