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 #3373

Merged
merged 9 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 9 additions & 8 deletions apple/RNCWebViewImpl.m
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ - (instancetype)initWithFrame:(CGRect)frame
_autoManageStatusBarEnabled = YES;
_contentInset = UIEdgeInsetsZero;
_savedKeyboardDisplayRequiresUserAction = YES;
#if !TARGET_OS_OSX
#if TARGET_OS_IOS
_savedStatusBarStyle = RCTSharedApplication().statusBarStyle;
_savedStatusBarHidden = RCTSharedApplication().statusBarHidden;
#endif // !TARGET_OS_OSX
#endif // !TARGET_OS_IOS
Saadnajmi marked this conversation as resolved.
Show resolved Hide resolved
_injectedJavaScript = nil;
_injectedJavaScriptForMainFrameOnly = YES;
_injectedJavaScriptBeforeContentLoaded = nil;
Expand All @@ -191,7 +191,7 @@ - (instancetype)initWithFrame:(CGRect)frame
#endif
}

#if !TARGET_OS_OSX
#if TARGET_OS_IOS
[[NSNotificationCenter defaultCenter]addObserver:self
selector:@selector(appDidBecomeActive)
name:UIApplicationDidBecomeActiveNotification
Expand Down Expand Up @@ -226,11 +226,11 @@ - (instancetype)initWithFrame:(CGRect)frame
object:nil];

}
#endif // !TARGET_OS_OSX
#endif // TARGET_OS_IOS
return self;
}

#if !TARGET_OS_OSX
#if TARGET_OS_IOS
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
// Only allow long press gesture
if ([otherGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) {
Expand Down Expand Up @@ -269,7 +269,7 @@ - (void)startLongPress:(UILongPressGestureRecognizer *)pressSender
[menuController setMenuVisible:YES animated:YES];
}

#endif // !TARGET_OS_OSX
#endif // TARGET_OS_IOS

- (void)dealloc
{
Expand Down Expand Up @@ -594,9 +594,10 @@ - (void)removeFromSuperview
#endif
}

#if !TARGET_OS_OSX
#if TARGET_OS_IOS
-(void)showFullScreenVideoStatusBars
{
#
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (!_autoManageStatusBarEnabled) {
return;
Expand Down Expand Up @@ -650,7 +651,7 @@ -(void)keyboardDisplacementFix
}];
}
}
#endif // !TARGET_OS_OSX
#endif // !TARGET_OS_IOS
Saadnajmi marked this conversation as resolved.
Show resolved Hide resolved

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{
if ([keyPath isEqual:@"estimatedProgress"] && object == self.webView) {
Expand Down
5 changes: 5 additions & 0 deletions example/visionos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require_relative '../../node_modules/react-native-test-app/visionos/test_app'

workspace 'WebviewExample.xcworkspace'

use_test_app!