[UI > Components] Add Discord's SafeAreaView

This commit is contained in:
Beef 2023-04-15 00:49:59 +01:00
parent 5344f0017a
commit 4d68c112bc
3 changed files with 6 additions and 4 deletions

1
src/def.d.ts vendored
View file

@ -416,6 +416,7 @@ interface VendettaObject {
Alert: _React.ComponentType;
Button: _React.ComponentType<any> & { Looks: any, Colors: ButtonColors, Sizes: any };
HelpMessage: _React.ComponentType;
SafeAreaView: typeof _RN.SafeAreaView;
// Vendetta
Summary: _React.ComponentType<SummaryProps>;
ErrorBoundary: _React.ComponentType<ErrorBoundaryProps>;

View file

@ -1,3 +1,4 @@
import { ReactNative as RN } from "@metro/common";
import { findByName, findByProps } from "@metro/filters";
// Discord
@ -7,6 +8,8 @@ export const Search = findByName("StaticSearchBarContainer");
export const Alert = findByProps("alertDarkStyles", "alertLightStyles").default;
export const Button = findByProps("Looks", "Colors", "Sizes") as React.ComponentType<any> & { Looks: any, Colors: any, Sizes: any };
export const HelpMessage = findByName("HelpMessage");
// React Native's included SafeAreaView only adds padding on iOS.
export const SafeAreaView = findByProps("useSafeAreaInsets").SafeAreaView as typeof RN.SafeAreaView;
// Vendetta
export { default as Summary } from "@ui/components/Summary";

View file

@ -5,13 +5,11 @@ import { after } from "@lib/patcher";
import { DeviceManager } from "@lib/native";
import { toggleSafeMode } from "@lib/debug";
import { semanticColors } from "@ui/color";
import { Button, Codeblock, ErrorBoundary as _ErrorBoundary } from "@ui/components";
import { Button, Codeblock, ErrorBoundary as _ErrorBoundary, SafeAreaView } from "@ui/components";
import settings from "@lib/settings";
const ErrorBoundary = findByName("ErrorBoundary");
// React Native's included SafeAreaView only adds padding on iOS.
const { SafeAreaView } = findByProps("useSafeAreaInsets");
// Let's just pray they have this.
const { BadgableTabBar } = findByProps("BadgableTabBar");