From 8a4d5fc0f3a68e11f246f5ce5b0359f1f498f0ec Mon Sep 17 00:00:00 2001 From: amsyarasyiq <82711525+amsyarasyiq@users.noreply.github.com> Date: Sun, 2 Jun 2024 14:35:14 +0800 Subject: [PATCH] fix(polyfill/vendetta): pass the right Button component --- src/core/polyfills/vendettaObject.tsx | 4 ++-- src/lib/ui/components/InputAlert.tsx | 6 +++--- src/metro/common/components.ts | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/core/polyfills/vendettaObject.tsx b/src/core/polyfills/vendettaObject.tsx index c14a1c5..be4cb38 100644 --- a/src/core/polyfills/vendettaObject.tsx +++ b/src/core/polyfills/vendettaObject.tsx @@ -142,8 +142,8 @@ export const initVendettaObject = (): any => { components: { Forms, General: common.ReactNative, - Alert: commonComponents.Alert, - Button: commonComponents.Button, + Alert: commonComponents.LegacyAlert, + Button: commonComponents.CompatButton, HelpMessage: (...props: any[]) => , SafeAreaView: (...props: any[]) => , Summary: components.Summary, diff --git a/src/lib/ui/components/InputAlert.tsx b/src/lib/ui/components/InputAlert.tsx index f4d85b8..7e3366f 100644 --- a/src/lib/ui/components/InputAlert.tsx +++ b/src/lib/ui/components/InputAlert.tsx @@ -1,5 +1,5 @@ import { ButtonColors } from "@lib/utils/types"; -import { Alert, LegacyFormInput } from "@metro/common/components"; +import { LegacyAlert, LegacyFormInput } from "@metro/common/components"; import { findByPropsProxy } from "@metro/utils"; const Alerts = findByPropsProxy("openLazy", "close"); @@ -30,7 +30,7 @@ export default function InputAlert({ title, confirmText, confirmColor, onConfirm } return ( - - + ); } diff --git a/src/metro/common/components.ts b/src/metro/common/components.ts index a547ce0..d579bfc 100644 --- a/src/metro/common/components.ts +++ b/src/metro/common/components.ts @@ -14,9 +14,10 @@ const findSingular = (prop: string) => proxyLazy(() => findExports(bySingularPro const findProp = (prop: string) => proxyLazy(() => findByProps(prop)[prop]); // Discord -export const Alert = findByDisplayNameProxy("FluxContainer(Alert)"); +export const LegacyAlert = findByDisplayNameProxy("FluxContainer(Alert)"); export const CompatButton = findByPropsProxy("Looks", "Colors", "Sizes"); export const HelpMessage = findByNameProxy("HelpMessage"); + // React Native's included SafeAreaView only adds padding on iOS. export const SafeAreaView = proxyLazy(() => findByProps("useSafeAreaInsets").SafeAreaView);