diff --git a/ios/Platform/Platform/Features/Fitness/Views/FoodSearchView.swift b/ios/Platform/Platform/Features/Fitness/Views/FoodSearchView.swift index 9079103..d15ab94 100644 --- a/ios/Platform/Platform/Features/Fitness/Views/FoodSearchView.swift +++ b/ios/Platform/Platform/Features/Fitness/Views/FoodSearchView.swift @@ -5,6 +5,7 @@ struct FoodSearchView: View { var onFoodAdded: (() -> Void)? @State private var vm = FoodSearchViewModel() @State private var selectedFood: Food? + @FocusState private var searchFocused: Bool var body: some View { VStack(spacing: 0) { @@ -15,6 +16,7 @@ struct FoodSearchView: View { TextField("Search foods...", text: $vm.searchText) .textFieldStyle(.plain) .autocorrectionDisabled() + .focused($searchFocused) if !vm.searchText.isEmpty { Button { vm.searchText = "" @@ -44,6 +46,11 @@ struct FoodSearchView: View { .background(Color.canvas) .task { await vm.loadInitial() + if isSheet { + // Small delay so sheet animation completes first + try? await Task.sleep(for: .milliseconds(300)) + searchFocused = true + } } .onChange(of: vm.searchText) { vm.search()