fix(app): prevent Android crash when opening Providers settings (#1537)
Closes #1504
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
import { useCallback, useMemo, useState } from "react";
|
import { useCallback, useMemo, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
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 { SvgXml } from "react-native-svg";
|
||||||
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
||||||
import { ExternalLink, PackagePlus, Search } from "lucide-react-native";
|
import { ExternalLink, PackagePlus, Search } from "lucide-react-native";
|
||||||
import { AdaptiveTextInput } from "@/components/adaptive-modal-sheet";
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
|
import { isWeb } from "@/constants/platform";
|
||||||
import {
|
import {
|
||||||
useAcpProviderCatalog,
|
useAcpProviderCatalog,
|
||||||
type AcpProviderCatalogItem,
|
type AcpProviderCatalogItem,
|
||||||
@@ -28,6 +28,9 @@ const ThemedPackagePlus = withUnistyles(PackagePlus);
|
|||||||
const ThemedSvgXml = withUnistyles(SvgXml);
|
const ThemedSvgXml = withUnistyles(SvgXml);
|
||||||
const ThemedSearch = withUnistyles(Search);
|
const ThemedSearch = withUnistyles(Search);
|
||||||
const ThemedExternalLink = withUnistyles(ExternalLink);
|
const ThemedExternalLink = withUnistyles(ExternalLink);
|
||||||
|
const ThemedTextInput = withUnistyles(TextInput, (theme) => ({
|
||||||
|
placeholderTextColor: theme.colors.foregroundMuted,
|
||||||
|
}));
|
||||||
|
|
||||||
const foregroundColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
const foregroundColorMapping = (theme: Theme) => ({ color: theme.colors.foreground });
|
||||||
const foregroundMutedColorMapping = (theme: Theme) => ({
|
const foregroundMutedColorMapping = (theme: Theme) => ({
|
||||||
@@ -145,13 +148,14 @@ export function ProviderCatalogList({
|
|||||||
<View style={styles.searchIcon}>
|
<View style={styles.searchIcon}>
|
||||||
<ThemedSearch size={SEARCH_ICON_SIZE} uniProps={foregroundMutedColorMapping} />
|
<ThemedSearch size={SEARCH_ICON_SIZE} uniProps={foregroundMutedColorMapping} />
|
||||||
</View>
|
</View>
|
||||||
<AdaptiveTextInput
|
<ThemedTextInput
|
||||||
testID="provider-catalog-search"
|
testID="provider-catalog-search"
|
||||||
value={search}
|
value={search}
|
||||||
onChangeText={setSearch}
|
onChangeText={setSearch}
|
||||||
accessibilityLabel={t("providerCatalog.search")}
|
accessibilityLabel={t("providerCatalog.search")}
|
||||||
placeholder={t("providerCatalog.search")}
|
placeholder={t("providerCatalog.search")}
|
||||||
style={styles.searchInput}
|
// @ts-expect-error - outlineStyle is web-only
|
||||||
|
style={SEARCH_INPUT_STYLE}
|
||||||
autoCapitalize="none"
|
autoCapitalize="none"
|
||||||
autoCorrect={false}
|
autoCorrect={false}
|
||||||
/>
|
/>
|
||||||
@@ -280,3 +284,5 @@ const styles = StyleSheet.create((theme) => ({
|
|||||||
fontSize: theme.fontSize.sm,
|
fontSize: theme.fontSize.sm,
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
const SEARCH_INPUT_STYLE = [styles.searchInput, isWeb && { outlineStyle: "none" }];
|
||||||
|
|||||||
Reference in New Issue
Block a user