Skip to content

Commit 060bdb6

Browse files
committed
fix Android crop issue
1 parent 9628cfd commit 060bdb6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/components/ReceiptCropView/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ function ReceiptCropView({imageUri, onCropChange, initialCrop, isAuthTokenRequir
5959
const cropY = useSharedValue(0);
6060
const cropWidth = useSharedValue(0);
6161
const cropHeight = useSharedValue(0);
62+
const isImageInitialized = useRef(false);
6263

6364
// Track previous values to detect changes and recalculate crop on resize
6465
const prevDisplayValuesRef = useRef<{
@@ -86,6 +87,8 @@ function ReceiptCropView({imageUri, onCropChange, initialCrop, isAuthTokenRequir
8687
} else {
8788
setImageSize({width, height});
8889
}
90+
91+
isImageInitialized.current = true;
8992
});
9093
}, [imageUri, isAuthTokenRequired]);
9194

@@ -262,7 +265,7 @@ function ReceiptCropView({imageUri, onCropChange, initialCrop, isAuthTokenRequir
262265
if (!hasImageDimensions) {
263266
setHasImageDimensions(true);
264267
}
265-
if (!imageSize.width && !imageSize.height) {
268+
if (!isImageInitialized.current) {
266269
setImageSize({width, height});
267270
}
268271
},

0 commit comments

Comments
 (0)