-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Fix toast overlay in modals (#103)
- Loading branch information
Showing
19 changed files
with
168 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
mobile/patches/@backpackapp-io__react-native-toast@0.11.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
diff --git a/src/components/Toast.tsx b/src/components/Toast.tsx | ||
index c598db60ff3d374db094493fb3a90ae5c4d59077..463219603128d5af80fa842c32b33423efdbbc50 100644 | ||
--- a/src/components/Toast.tsx | ||
+++ b/src/components/Toast.tsx | ||
@@ -130,7 +130,7 @@ export const Toast: FC<Props> = ({ | ||
kbHeight - | ||
insets.bottom - | ||
(extraInsets?.bottom ?? 0) - | ||
- 24 | ||
+ 0 | ||
: startingY; | ||
|
||
offsetY.value = withSpring(val, { | ||
@@ -241,6 +241,7 @@ export const Toast: FC<Props> = ({ | ||
endPause(); | ||
}} | ||
onPress={onPress} | ||
+ pointerEvents="box-none" | ||
style={[ | ||
{ | ||
backgroundColor: !toast.customToast | ||
@@ -267,6 +268,7 @@ export const Toast: FC<Props> = ({ | ||
updateHeight(toast.id, event.nativeEvent.layout.height) | ||
} | ||
key={toast.id} | ||
+ pointerEvents="box-none" | ||
> | ||
{toast.customToast({ | ||
...toast, |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import type { | ||
Toast, | ||
ToastOptions as TOptions, | ||
} from "@backpackapp-io/react-native-toast"; | ||
import { ToastPosition } from "@backpackapp-io/react-native-toast"; | ||
import { Text, View } from "react-native"; | ||
|
||
import { cn } from "./style"; | ||
|
||
/** Sensible defaults for toast. */ | ||
export const ToastOptions = { | ||
customToast: CustomToast, | ||
disableShadow: true, | ||
position: ToastPosition.BOTTOM, | ||
height: 36, | ||
providerKey: "PERSISTS", | ||
} satisfies TOptions; | ||
|
||
/** Render a custom toast (makes styling for light/dark mode easier). */ | ||
function CustomToast({ type, message, height, width }: Toast) { | ||
return ( | ||
<View | ||
pointerEvents="box-none" | ||
style={{ minHeight: height, width }} | ||
className="items-center justify-center" | ||
> | ||
<View | ||
style={{ elevation: 2, shadowColor: "#000" }} | ||
className={cn("rounded bg-surface p-2", { | ||
"bg-red": type === "error", | ||
})} | ||
> | ||
<Text | ||
className={cn("text-center font-roboto text-sm text-foreground", { | ||
"text-neutral100": type === "error", | ||
})} | ||
> | ||
{message as string} | ||
</Text> | ||
</View> | ||
</View> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
import { Toasts } from "@backpackapp-io/react-native-toast"; | ||
import { BottomSheetModalProvider } from "@gorhom/bottom-sheet"; | ||
import { QueryClientProvider } from "@tanstack/react-query"; | ||
import { SheetProvider } from "react-native-actions-sheet"; | ||
import { GestureHandlerRootView } from "react-native-gesture-handler"; | ||
import { SafeAreaProvider } from "react-native-safe-area-context"; | ||
|
||
import "@/screens/Sheets"; | ||
import { RouteHandlers } from "./RouteHandlers"; | ||
import { ThemeProvider } from "./ThemeProvider"; | ||
import { ToastProvider } from "./ToastProvider"; | ||
|
||
import { queryClient } from "@/lib/react-query"; | ||
|
||
/** All providers used by the app. */ | ||
export function AppProvider({ children }: { children: React.ReactNode }) { | ||
return ( | ||
<ThemeProvider> | ||
<GestureHandlerRootView> | ||
<ToastProvider> | ||
<SafeAreaProvider> | ||
<GestureHandlerRootView> | ||
<QueryClientProvider client={queryClient}> | ||
<RouteHandlers /> | ||
<SheetProvider context="global"> | ||
<BottomSheetModalProvider>{children}</BottomSheetModalProvider> | ||
<BottomSheetModalProvider> | ||
{children} | ||
<Toasts /> | ||
</BottomSheetModalProvider> | ||
</SheetProvider> | ||
</QueryClientProvider> | ||
</ToastProvider> | ||
</GestureHandlerRootView> | ||
</GestureHandlerRootView> | ||
</SafeAreaProvider> | ||
</ThemeProvider> | ||
); | ||
} |
Oops, something went wrong.