Fix agent preferences sheet restoring tab switcher on close
Use stackBehavior="replace" on the preferences BottomSheetModal so it dismisses the tab switcher combobox instead of minimizing it, preventing the provider from auto-restoring the tab switcher when preferences closes.
This commit is contained in:
@@ -101,6 +101,7 @@ export interface AdaptiveModalSheetProps {
|
|||||||
onClose: () => void;
|
onClose: () => void;
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
snapPoints?: string[];
|
snapPoints?: string[];
|
||||||
|
stackBehavior?: "push" | "switch" | "replace";
|
||||||
testID?: string;
|
testID?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +111,7 @@ export function AdaptiveModalSheet({
|
|||||||
onClose,
|
onClose,
|
||||||
children,
|
children,
|
||||||
snapPoints,
|
snapPoints,
|
||||||
|
stackBehavior,
|
||||||
testID,
|
testID,
|
||||||
}: AdaptiveModalSheetProps) {
|
}: AdaptiveModalSheetProps) {
|
||||||
const { theme } = useUnistyles();
|
const { theme } = useUnistyles();
|
||||||
@@ -159,6 +161,7 @@ export function AdaptiveModalSheet({
|
|||||||
onChange={handleSheetChange}
|
onChange={handleSheetChange}
|
||||||
backdropComponent={renderBackdrop}
|
backdropComponent={renderBackdrop}
|
||||||
enablePanDownToClose
|
enablePanDownToClose
|
||||||
|
stackBehavior={stackBehavior}
|
||||||
backgroundComponent={SheetBackground}
|
backgroundComponent={SheetBackground}
|
||||||
handleIndicatorStyle={styles.bottomSheetHandle}
|
handleIndicatorStyle={styles.bottomSheetHandle}
|
||||||
keyboardBehavior="extend"
|
keyboardBehavior="extend"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useMemo, useRef, useState } from "react";
|
import { useCallback, useMemo, useRef, useState } from "react";
|
||||||
import { View, Text, Platform, Pressable } from "react-native";
|
import { View, Text, Platform, Pressable, Keyboard } from "react-native";
|
||||||
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
import { StyleSheet, useUnistyles } from "react-native-unistyles";
|
||||||
import { Brain, ChevronDown, ShieldAlert, ShieldCheck, ShieldOff } from "lucide-react-native";
|
import { Brain, ChevronDown, ShieldAlert, ShieldCheck, ShieldOff } from "lucide-react-native";
|
||||||
import { getProviderIcon } from "@/components/provider-icons";
|
import { getProviderIcon } from "@/components/provider-icons";
|
||||||
@@ -427,7 +427,10 @@ function ControlledStatusBar({
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<Pressable
|
<Pressable
|
||||||
onPress={() => setPrefsOpen(true)}
|
onPress={() => {
|
||||||
|
Keyboard.dismiss();
|
||||||
|
setPrefsOpen(true);
|
||||||
|
}}
|
||||||
style={({ pressed }) => [styles.prefsButton, pressed && styles.prefsButtonPressed]}
|
style={({ pressed }) => [styles.prefsButton, pressed && styles.prefsButtonPressed]}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
accessibilityLabel="Agent preferences"
|
accessibilityLabel="Agent preferences"
|
||||||
@@ -443,6 +446,7 @@ function ControlledStatusBar({
|
|||||||
title="Preferences"
|
title="Preferences"
|
||||||
visible={prefsOpen}
|
visible={prefsOpen}
|
||||||
onClose={() => setPrefsOpen(false)}
|
onClose={() => setPrefsOpen(false)}
|
||||||
|
stackBehavior="replace"
|
||||||
testID="agent-preferences-sheet"
|
testID="agent-preferences-sheet"
|
||||||
>
|
>
|
||||||
{providerOptions && providerOptions.length > 0 ? (
|
{providerOptions && providerOptions.length > 0 ? (
|
||||||
|
|||||||
Reference in New Issue
Block a user