We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
__source
useImage
1 parent b085491 commit eda3f9aCopy full SHA for eda3f9a
packages/react-native-nitro-image/src/useImage.ts
@@ -38,7 +38,14 @@ export function useImage(source: AsyncImageSource): Result {
38
useEffect(() => {
39
(async () => {
40
try {
41
+ // 1. Create the Image/ImageLoader instance
42
const result = await loadImage(source);
43
+ // 2. Add `__source` as a property on the JS side so React diffs properly
44
+ Object.defineProperty(result, "__source", {
45
+ enumerable: true,
46
+ configurable: true,
47
+ value: source,
48
+ });
49
setImage({ image: result, error: undefined });
50
} catch (e) {
51
const error = e instanceof Error ? e : new Error(`${e}`);
0 commit comments