fix(app): prevent Android crash when opening Providers settings (#1537)

Closes #1504
This commit is contained in:
Mohamed Boudra
2026-06-15 00:15:47 +08:00
committed by GitHub
parent 43e17c1e7c
commit f4450cda51
@@ -1,11 +1,11 @@
import { useCallback, useMemo, useState } from "react";
import { useTranslation } from "react-i18next";
import { Pressable, Text, View } from "react-native";
import { Pressable, Text, TextInput, View } from "react-native";
import { SvgXml } from "react-native-svg";
import { StyleSheet, withUnistyles } from "react-native-unistyles";
import { ExternalLink, PackagePlus, Search } from "lucide-react-native";
import { AdaptiveTextInput } from "@/components/adaptive-modal-sheet";
import { Button } from "@/components/ui/button";
import { isWeb } from "@/constants/platform";
import {
useAcpProviderCatalog,
type AcpProviderCatalogItem,
@@ -28,6 +28,9 @@ const ThemedPackagePlus = withUnistyles(PackagePlus);
const ThemedSvgXml = withUnistyles(SvgXml);
const ThemedSearch = withUnistyles(Search);
const ThemedExternalLink = withUnistyles(ExternalLink);
const ThemedTextInput = withUnistyles(TextInput, (theme) => ({
placeholderTextColor: theme.colors.foregroundMuted,
}));
const foregroundColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
const foregroundMutedColorMapping = (theme: Theme) => ({
@@ -145,13 +148,14 @@ export function ProviderCatalogList({
<View style={styles.searchIcon}>
<ThemedSearch size={SEARCH_ICON_SIZE} uniProps={foregroundMutedColorMapping} />
</View>
<AdaptiveTextInput
<ThemedTextInput
testID="provider-catalog-search"
value={search}
onChangeText={setSearch}
accessibilityLabel={t("providerCatalog.search")}
placeholder={t("providerCatalog.search")}
style={styles.searchInput}
// @ts-expect-error - outlineStyle is web-only
style={SEARCH_INPUT_STYLE}
autoCapitalize="none"
autoCorrect={false}
/>
@@ -280,3 +284,5 @@ const styles = StyleSheet.create((theme) => ({
fontSize: theme.fontSize.sm,
},
}));
const SEARCH_INPUT_STYLE = [styles.searchInput, isWeb && { outlineStyle: "none" }];