mirror of
https://github.com/zoriya/react-native-svg.git
synced 2026-05-29 13:21:50 +00:00
feat: add visionOS support (#2190)
This PR adds support for visionOS. I've migrated the `UIScreen` API to take `displayScale` from `currentTraitCollection` - same as I did in Core (https://github.com/facebook/react-native/pull/41214/files)
This commit is contained in:
committed by
GitHub
parent
2806bb2bee
commit
068820b3fa
@@ -245,10 +245,17 @@ UInt32 saturate(CGFloat value)
|
||||
CGSize boundsSize = bounds.size;
|
||||
CGFloat height = boundsSize.height;
|
||||
CGFloat width = boundsSize.width;
|
||||
CGFloat scale = 0.0;
|
||||
#if TARGET_OS_OSX
|
||||
CGFloat scale = [[NSScreen mainScreen] backingScaleFactor];
|
||||
scale = [[NSScreen mainScreen] backingScaleFactor];
|
||||
#else
|
||||
CGFloat scale = [[UIScreen mainScreen] scale];
|
||||
if (@available(iOS 13.0, *)) {
|
||||
scale = [UITraitCollection currentTraitCollection].displayScale;
|
||||
} else {
|
||||
#if !TARGET_OS_VISION
|
||||
scale = [[UIScreen mainScreen] scale];
|
||||
#endif
|
||||
}
|
||||
#endif // TARGET_OS_OSX
|
||||
NSUInteger iheight = (NSUInteger)height;
|
||||
NSUInteger iwidth = (NSUInteger)width;
|
||||
|
||||
Reference in New Issue
Block a user