Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix receipt image blink when opening it the first time #33860

Merged
merged 12 commits into from
Mar 5, 2024
7 changes: 6 additions & 1 deletion src/components/MultiGestureCanvas/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ type MultiGestureCanvasProps = ChildrenProps & {
onSwipeDown?: OnSwipeDownCallback;
};

const defaultContentSize = {width: 1, height: 1};

function MultiGestureCanvas({
canvasSize,
contentSize = {width: 1, height: 1},
contentSize: contentSizeProp,
zoomRange: zoomRangeProp,
isActive = true,
children,
Expand All @@ -66,6 +68,7 @@ function MultiGestureCanvas({
const styles = useThemeStyles();
const StyleUtils = useStyleUtils();

const contentSize = contentSizeProp ?? defaultContentSize;
const shouldDisableTransformationGesturesFallback = useSharedValue(false);
const shouldDisableTransformationGestures = shouldDisableTransformationGesturesProp ?? shouldDisableTransformationGesturesFallback;

Expand Down Expand Up @@ -224,6 +227,8 @@ function MultiGestureCanvas({
},
{scale: totalScale.value},
],
// Hide the image if the size is not ready yet
opacity: contentSizeProp?.width ? 1 : 0,
};
});

Expand Down
Loading