fix(shared-transition): iOS snapshot opacity (#10278)

This commit is contained in:
Igor Randjelovic
2023-04-26 20:17:39 +02:00
committed by GitHub
parent f24ac1d713
commit b8a548f009

View File

@ -368,10 +368,13 @@ export namespace iOSNativeHelper {
return view.image; return view.image;
} }
// console.log('snapshotView view.frame:', printRect(view.frame)); // console.log('snapshotView view.frame:', printRect(view.frame));
const originalOpacity = view.layer.opacity;
view.layer.opacity = originalOpacity > 0 ? originalOpacity : 1;
UIGraphicsBeginImageContextWithOptions(CGSizeMake(view.frame.size.width, view.frame.size.height), false, scale); UIGraphicsBeginImageContextWithOptions(CGSizeMake(view.frame.size.width, view.frame.size.height), false, scale);
view.layer.renderInContext(UIGraphicsGetCurrentContext()); view.layer.renderInContext(UIGraphicsGetCurrentContext());
const image = UIGraphicsGetImageFromCurrentImageContext(); const image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext(); UIGraphicsEndImageContext();
view.layer.opacity = originalOpacity;
return image; return image;
} }