Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ import { useSafeAreaInsets } from "react-native-safe-area-context";
import { AndroidScreenHeader } from "../../components/AndroidScreenHeader";
import { SymbolView } from "../../components/AppSymbol";
import { AppText as Text, AppTextInput as TextInput } from "../../components/AppText";
import { NativeStackScreenOptions } from "../../native/StackHeader";
import { NativeHeaderToolbar, NativeStackScreenOptions } from "../../native/StackHeader";
import {
createNativeMailSearchToolbarItem,
NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET,
NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED,
} from "../layout/native-mail-search-toolbar";
import { getMobileThirdPartyLicenses } from "./mobileThirdPartyLicenses";

function useMobileThirdPartyLicenses() {
Expand Down Expand Up @@ -65,6 +70,7 @@ export function SettingsOpenSourceLicensesRouteScreen() {
const navigation = useNavigation();
const insets = useSafeAreaInsets();
const [query, setQuery] = useState("");
const usesNativeMailSearchToolbar = Platform.OS === "ios" && NATIVE_MAIL_SEARCH_TOOLBAR_SUPPORTED;
const manifest = useMobileThirdPartyLicenses();
const entries = manifest?.entries ?? [];
const filteredEntries = useMemo(
Expand Down Expand Up @@ -109,6 +115,39 @@ export function SettingsOpenSourceLicensesRouteScreen() {

return (
<View collapsable={false} className="flex-1 bg-sheet">
{Platform.OS === "ios" ? (
<NativeStackScreenOptions
options={{
unstable_headerToolbarItems: usesNativeMailSearchToolbar
? () => [
createNativeMailSearchToolbarItem({
onSearchTextChange: setQuery,
placeholder: "Search packages",
searchTextChangeId: "open-source-licenses-search-text",
showsSearchDismissButton: true,
}),
]
: undefined,
headerSearchBarOptions: usesNativeMailSearchToolbar
? undefined
: {
allowToolbarIntegration: true,
autoCapitalize: "none",
hideNavigationBar: false,
hideWhenScrolling: false,
obscureBackground: false,
onCancelButtonPress: () => setQuery(""),
onChangeText: (event) => setQuery(event.nativeEvent.text),
placeholder: "Search packages",
},
}}
/>
) : null}
{Platform.OS === "ios" && !usesNativeMailSearchToolbar ? (
<NativeHeaderToolbar placement="bottom">
<NativeHeaderToolbar.SearchBarSlot />
</NativeHeaderToolbar>
) : null}
{Platform.OS === "android" ? (
<>
<NativeStackScreenOptions options={{ headerShown: false }} />
Expand All @@ -117,7 +156,13 @@ export function SettingsOpenSourceLicensesRouteScreen() {
) : null}
<LegendList
className="flex-1"
contentContainerStyle={{ paddingBottom: Math.max(insets.bottom, 18) + 18 }}
contentContainerStyle={{
paddingBottom: usesNativeMailSearchToolbar
? NATIVE_MAIL_SEARCH_TOOLBAR_CONTENT_INSET + 18
: Platform.OS === "ios"
? 18
: Math.max(insets.bottom, 18) + 18,
}}
contentInsetAdjustmentBehavior="automatic"
data={filteredEntries}
estimatedItemSize={78}
Expand All @@ -132,26 +177,20 @@ export function SettingsOpenSourceLicensesRouteScreen() {
</View>
}
ListHeaderComponent={
<View className="gap-4 px-5 pt-4 pb-5">
<Text className="text-base leading-normal text-foreground-muted">
Notices for dependencies, assets, and optional tools used by T3 Code Mobile.
</Text>
<TextInput
accessibilityLabel="Search open-source licenses"
autoCapitalize="none"
autoCorrect={false}
clearButtonMode="while-editing"
onChangeText={setQuery}
placeholder="Search packages"
returnKeyType="search"
value={query}
/>
<Text className="tabular-nums text-sm text-foreground-muted">
{filteredEntries.length === entries.length
? `${String(entries.length)} notices`
: `${String(filteredEntries.length)} of ${String(entries.length)} notices`}
</Text>
</View>
Platform.OS !== "ios" ? (
<View className="px-5 pt-4 pb-5">
<TextInput
accessibilityLabel="Search open-source licenses"
autoCapitalize="none"
autoCorrect={false}
clearButtonMode="while-editing"
onChangeText={setQuery}
placeholder="Search packages"
returnKeyType="search"
value={query}
/>
</View>
) : null
}
renderItem={renderItem}
showsVerticalScrollIndicator={false}
Expand Down
Loading