Skip to content
This repository was archived by the owner on May 17, 2025. It is now read-only.

Commit 6f52993

Browse files
committed
fix: set bottom inset for floating buttons
credit to e987723
1 parent 5e3f9b7 commit 6f52993

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

src/core/ui/components/AddonPage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import isValidHttpUrl from "@lib/utils/isValidHttpUrl";
77
import { lazyDestructure } from "@lib/utils/lazy";
88
import { findByProps } from "@metro";
99
import { clipboard } from "@metro/common";
10-
import { Button, FlashList, FloatingActionButton, HelpMessage, IconButton, Stack, Text, TextInput } from "@metro/common/components";
10+
import { Button, FlashList, FloatingActionButton, HelpMessage, IconButton, Stack, Text, TextInput, useSafeAreaInsets } from "@metro/common/components";
1111
import { ErrorBoundary, Search } from "@ui/components";
1212
import fuzzysort from "fuzzysort";
1313
import { ComponentType, ReactNode, useCallback, useMemo } from "react";
@@ -111,6 +111,7 @@ export default function AddonPage<T extends object>({ CardComponent, ...props }:
111111

112112
const [search, setSearch] = React.useState("");
113113
const [sortFn, setSortFn] = React.useState<((a: unknown, b: unknown) => number) | null>(() => null);
114+
const { bottom: bottomInset } = useSafeAreaInsets();
114115

115116
const results = useMemo(() => {
116117
let values = props.items;
@@ -198,6 +199,7 @@ export default function AddonPage<T extends object>({ CardComponent, ...props }:
198199
renderItem={({ item }: any) => <CardComponent item={item.obj} result={item} />}
199200
/>
200201
{props.installAction && <FloatingActionButton
202+
positionBottom={bottomInset + 8}
201203
icon={findAssetId("PlusLargeIcon")}
202204
onPress={onInstallPress}
203205
/>}

src/metro/common/components.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export const CompatButton = findByPropsLazy("Looks", "Colors", "Sizes");
2020
export const HelpMessage = findByNameLazy("HelpMessage");
2121

2222
// React Native's included SafeAreaView only adds padding on iOS.
23-
export const { SafeAreaView, SafeAreaProvider } = lazyDestructure(() => findByProps("useSafeAreaInsets"));
23+
export const { SafeAreaView, SafeAreaProvider, useSafeAreaInsets } = lazyDestructure(() => findByProps("useSafeAreaInsets"));
2424

2525
// ActionSheet
2626
export const ActionSheetRow = findProp("ActionSheetRow");

src/metro/common/types/components.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ interface FABProps {
133133
icon: ImageSourcePropType | ReactNode;
134134
style?: Style;
135135
onPress: () => void;
136+
positionBottom?: number;
136137
}
137138

138139
export type FloatingActionButton = React.FC<FABProps>;

0 commit comments

Comments
 (0)