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

feat: add visionos support #5627

Merged
merged 7 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions MacOSExample/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -577,11 +577,11 @@ SPEC CHECKSUMS:
ReactCommon: 6f2738740f0a5677dc3554112d49ce10d2b0a576
RNCAsyncStorage: c913ede1fa163a71cea118ed4670bbaaa4b511bb
RNCPicker: 529d564911e93598cc399b56cc0769ce3675f8c8
RNReanimated: 71dba8af3fcf22b055c801febf963fd3f3da6f73
RNReanimated: ce7bb3c62611851fc282f079b8a4dd92b4dec414
RNSVG: d00c8f91c3cbf6d476451313a18f04d220d4f396
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: b01d8e70b1bc0e88b40040a7d9c50fdadb1054b9

PODFILE CHECKSUM: b964368aafa7380114b03271f85998831a6e0f0b

COCOAPODS: 1.14.2
COCOAPODS: 1.14.3
2 changes: 1 addition & 1 deletion RNReanimated.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/software-mansion/react-native-reanimated"
s.license = "MIT"
s.author = { "author" => "author@domain.cn" }
s.platforms = { :ios => ios_min_version, :tvos => "9.0", :osx => "10.14" }
s.platforms = { :ios => ios_min_version, :tvos => "9.0", :osx => "10.14", :visionos => "1.0" }
s.source = { :git => "https://github.com/software-mansion/react-native-reanimated.git", :tag => "#{s.version}" }

s.source_files = [
Expand Down
4 changes: 4 additions & 0 deletions apple/LayoutReanimation/REAAnimationsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,11 @@ - (void)setNewProps:(NSMutableDictionary *)newProps
if (needsViewPositionUpdate) {
CGPoint newCenter = CGPointMake(centerX, centerY);
if (convertFromAbsolute) {
#if TARGET_OS_OSX
REAUIView *window = UIApplication.sharedApplication.keyWindow;
#else
REAUIView *window = RCTKeyWindow();
#endif
CGPoint convertedCenter = [window convertPoint:newCenter toView:view.superview];
view.center = convertedCenter;
} else {
Expand Down
4 changes: 4 additions & 0 deletions apple/LayoutReanimation/REASharedTransitionManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,11 @@ - (void)configureTransitionContainer
{
if (!_isSharedTransitionActive) {
_isSharedTransitionActive = YES;
#if TARGET_OS_OSX
REAUIView *mainWindow = UIApplication.sharedApplication.keyWindow;
#else
REAUIView *mainWindow = (REAUIView *)RCTKeyWindow();
#endif
if (_transitionContainer == nil) {
_transitionContainer = [REAUIView new];
}
Expand Down
5 changes: 5 additions & 0 deletions apple/LayoutReanimation/REASnapshot.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import <Foundation/Foundation.h>
#import <RNReanimated/REAScreensHelper.h>
#import <RNReanimated/REASnapshot.h>
#import <React/RCTUtils.h>
#import <React/RCTView.h>
#import <React/UIView+React.h>

Expand All @@ -27,7 +28,11 @@ - (instancetype)initWithAbsolutePosition:(REAUIView *)view

- (void)makeSnapshotForView:(REAUIView *)view useAbsolutePositionOnly:(BOOL)useAbsolutePositionOnly
{
#if TARGET_OS_OSX
REAUIView *mainWindow = UIApplication.sharedApplication.keyWindow;
#else
REAUIView *mainWindow = RCTKeyWindow();
#endif
CGPoint absolutePosition = [[view superview] convertPoint:view.center toView:nil];
_values = [NSMutableDictionary new];
#if TARGET_OS_OSX
Expand Down
2 changes: 1 addition & 1 deletion apple/sensor/ReanimatedSensor.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#import <RNReanimated/ReanimatedSensor.h>

#if !TARGET_OS_TV && !TARGET_OS_OSX
#if !TARGET_OS_TV && !TARGET_OS_OSX && !TARGET_OS_VISION
@implementation ReanimatedSensor
piaskowyk marked this conversation as resolved.
Show resolved Hide resolved

- (instancetype)init:(ReanimatedSensorType)sensorType
Expand Down
Loading