[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

3
src/def.d.ts vendored
View file

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

View file

@ -1,3 +1,4 @@
import { ReactNative as RN } from "@metro/common";
import { findByName, findByProps } from "@metro/filters"; import { findByName, findByProps } from "@metro/filters";
// Discord // Discord
@ -7,6 +8,8 @@ export const Search = findByName("StaticSearchBarContainer");
export const Alert = findByProps("alertDarkStyles", "alertLightStyles").default; 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 Button = findByProps("Looks", "Colors", "Sizes") as React.ComponentType<any> & { Looks: any, Colors: any, Sizes: any };
export const HelpMessage = findByName("HelpMessage"); 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 // Vendetta
export { default as Summary } from "@ui/components/Summary"; 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 { DeviceManager } from "@lib/native";
import { toggleSafeMode } from "@lib/debug"; import { toggleSafeMode } from "@lib/debug";
import { semanticColors } from "@ui/color"; 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"; import settings from "@lib/settings";
const ErrorBoundary = findByName("ErrorBoundary"); 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. // Let's just pray they have this.
const { BadgableTabBar } = findByProps("BadgableTabBar"); const { BadgableTabBar } = findByProps("BadgableTabBar");