From ed7a6acb39618c3497411e92df4ed14857dcd2b9 Mon Sep 17 00:00:00 2001 From: DIYgod Date: Sat, 12 Apr 2025 10:53:57 +0800 Subject: [PATCH] feat(mobile): add ErrorBoundary to ExpoImage --- apps/mobile/src/components/ui/image/Image.tsx | 52 +++++++++++++------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/apps/mobile/src/components/ui/image/Image.tsx b/apps/mobile/src/components/ui/image/Image.tsx index 18b77ea44..12291ebb3 100644 --- a/apps/mobile/src/components/ui/image/Image.tsx +++ b/apps/mobile/src/components/ui/image/Image.tsx @@ -5,8 +5,12 @@ import type { } from "expo-image" import { Image as ExpoImage } from "expo-image" import { forwardRef, useCallback, useMemo, useState } from "react" +import type { ViewStyle } from "react-native" +import { Text, View } from "react-native" import { useColor } from "react-native-uikit-colors" +import { ErrorBoundary } from "@/src/components/common/ErrorBoundary" + import { getAllSources } from "./utils" export type ImageProps = Omit & { @@ -57,23 +61,37 @@ export const Image = forwardRef( } return ( - + ( + + {error.message} + + )} + > + + ) }, )