Skip to content

Commit

Permalink
chore: sync with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Sep 17, 2024
1 parent a916898 commit 2133cbb
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 720 deletions.
2 changes: 1 addition & 1 deletion packages/helloworld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"dependencies": {
"react": "19.0.0-rc-fb9a90fa48-20240614",
"@callstack/react-native-visionos": "1000.0.0"
"@callstack/react-native-visionos": "0.77.0-main"
},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/out-of-tree-platforms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@callstack/out-of-tree-platforms",
"version": "0.76.0-main",
"version": "0.77.0-main",
"description": "Utils for React Native out of tree platforms.",
"keywords": ["out-of-tree", "react-native"],
"homepage": "https://github.com/callstack/react-native-visionos/tree/HEAD/packages/out-of-tree-platforms#readme",
Expand All @@ -19,7 +19,7 @@
"dist"
],
"devDependencies": {

Check warning on line 21 in packages/out-of-tree-platforms/package.json

View workflow job for this annotation

GitHub Actions / test_js (20)

Trailing spaces not allowed

Check warning on line 21 in packages/out-of-tree-platforms/package.json

View workflow job for this annotation

GitHub Actions / test_js (18)

Trailing spaces not allowed
"metro-resolver": "^0.80.0"
"metro-resolver": "^0.81.0-alpha.0"
},
"engines": {
"node": ">=18"
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-test-library/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
],
"devDependencies": {
"@babel/core": "^7.25.2",
"@react-native/babel-preset": "0.76.0-main",
"@react-native/babel-preset": "0.77.0-main",
"@callstack/react-native-visionos": "0.77.0-main"
},
"peerDependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
#import <react/renderer/graphics/ColorComponents.h>
#import "RCTAppDelegate+Protected.h"
#import "RCTAppSetupUtils.h"
#import <objc/runtime.h>

#if RN_DISABLE_OSS_PLUGIN_HEADER
#import <RCTTurboModulePlugin/RCTTurboModulePlugin.h>
Expand Down
16 changes: 0 additions & 16 deletions packages/react-native/React/Base/RCTConvert.mm
Original file line number Diff line number Diff line change
Expand Up @@ -545,22 +545,6 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC
UIViewContentModeScaleAspectFill,
integerValue)

RCT_ENUM_CONVERTER(
UIBarStyle,
(@{
@"default" : @(UIBarStyleDefault),
@"black" : @(UIBarStyleBlack),
#if TARGET_OS_VISION
@"blackOpaque" : @(UIBarStyleBlack),
@"blackTranslucent" : @(UIBarStyleBlack),
#else
@"blackOpaque" : @(UIBarStyleBlackOpaque),
@"blackTranslucent" : @(UIBarStyleBlackTranslucent),
#endif
}),
UIBarStyleDefault,
integerValue)

RCT_ENUM_CONVERTER(
RCTCursor,
(@{
Expand Down
6 changes: 1 addition & 5 deletions packages/react-native/React/Base/RCTKeyCommands.m
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,7 @@ - (void)handleKeyUIEventSwizzle:(UIEvent *)event
if ([event respondsToSelector:@selector(_isKeyDown)]) {
isKeyDown = [event _isKeyDown];
}
#if !TARGET_OS_VISION
BOOL interactionEnabled = !RCTSharedApplication().isIgnoringInteractionEvents;
#else
BOOL interactionEnabled = true;
#endif

BOOL hasFirstResponder = NO;
if (isKeyDown && modifiedInput.length > 0) {
UIResponder *firstResponder = nil;
Expand Down
18 changes: 3 additions & 15 deletions packages/react-native/React/CoreModules/RCTStatusBarManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ + (BOOL)requiresMainQueueSetup

- (void)startObserving
{
#if !TARGET_OS_VISION
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver:self
selector:@selector(applicationDidChangeStatusBarFrame:)
Expand All @@ -89,19 +88,15 @@ - (void)startObserving
selector:@selector(applicationWillChangeStatusBarFrame:)
name:UIApplicationWillChangeStatusBarFrameNotification
object:nil];
#endif
}

- (void)stopObserving
{
#if !TARGET_OS_VISION
[[NSNotificationCenter defaultCenter] removeObserver:self];
#endif
}

- (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notification
{
#if !TARGET_OS_VISION
CGRect frame = [notification.userInfo[UIApplicationStatusBarFrameUserInfoKey] CGRectValue];
NSDictionary *event = @{
@"frame" : @{
Expand All @@ -112,7 +107,6 @@ - (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notifi
},
};
[self sendEventWithName:eventName body:event];
#endif
}

- (void)applicationDidChangeStatusBarFrame:(NSNotification *)notification
Expand All @@ -134,7 +128,6 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification

RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated)
{
#if !TARGET_OS_VISION
dispatch_async(dispatch_get_main_queue(), ^{
UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style];
if (RCTViewControllerBasedStatusBarAppearance()) {
Expand All @@ -143,16 +136,14 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[RCTSharedApplication() setStatusBarStyle:statusBarStyle animated:animated];
}
[RCTSharedApplication() setStatusBarStyle:statusBarStyle animated:animated];
}
#pragma clang diagnostic pop
});
#endif
}

RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation)
{
#if !TARGET_OS_VISION
dispatch_async(dispatch_get_main_queue(), ^{
UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation];
if (RCTViewControllerBasedStatusBarAppearance()) {
Expand All @@ -161,24 +152,21 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
[RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation];
#pragma clang diagnostic pop
}
});
#endif
}

RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible)
{
#if !TARGET_OS_VISION
dispatch_async(dispatch_get_main_queue(), ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// This is no longer supported in iOS 13 and later. We will remove this method in a future release.
RCTSharedApplication().networkActivityIndicatorVisible = visible;
#pragma clang diagnostic pop
});
#endif
}

- (facebook::react::ModuleConstants<JS::NativeStatusBarManagerIOS::Constants>)getConstants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ - (BOOL)prefersStatusBarHidden
#if RCT_DEV && TARGET_OS_IOS
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
#if !TARGET_OS_VISION
UIInterfaceOrientationMask appSupportedOrientationsMask =
[RCTSharedApplication() supportedInterfaceOrientationsForWindow:RCTKeyWindow()];
if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
Expand All @@ -75,9 +74,6 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations
}

return _supportedInterfaceOrientations;
#else
return UIInterfaceOrientationUnknown;
#endif
}
#endif // RCT_DEV

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ - (BOOL)prefersStatusBarHidden
#if RCT_DEV && TARGET_OS_IOS
- (UIInterfaceOrientationMask)supportedInterfaceOrientations
{
#if !TARGET_OS_VISION
UIInterfaceOrientationMask appSupportedOrientationsMask =
[RCTSharedApplication() supportedInterfaceOrientationsForWindow:RCTKeyWindow()];
if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) {
Expand All @@ -68,9 +67,6 @@ - (UIInterfaceOrientationMask)supportedInterfaceOrientations
}

return _supportedInterfaceOrientations;
#else
return UIInterfaceOrientationUnknown;
#endif
}
#endif // RCT_DEV

Expand Down
30 changes: 16 additions & 14 deletions packages/react-native/local-cli/localCommands.js
Original file line number Diff line number Diff line change
@@ -1,45 +1,47 @@
const {
createBuild,
createLog,
createRun,
getRunOptions,
getLogOptions,
getBuildOptions,
} = require('@react-native-community/cli-platform-apple');
let apple;
try {
apple = require('@react-native-community/cli-platform-apple');
} catch {
if (verbose) {
console.warn(
'@react-native-community/cli-platform-apple not found, the react-native.config.js may be unusable.',
);
}
}

const platformName = 'visionos';

const run = {
name: 'run-visionos',
description: 'builds your app and starts it on visionOS simulator',
func: createRun({platformName}),
func: apple.createRun({platformName}),
examples: [
{
desc: 'Run on a specific simulator',
cmd: 'npx @callstack/react-native-visionos run-visionos --simulator "Apple Vision Pro"',
},
],
options: getRunOptions({platformName}),
options: apple.getRunOptions({platformName}),
};

const log = {
name: 'log-visionos',
description: 'starts visionOS device syslog tail',
func: createLog({platformName: 'visionos'}),
options: getLogOptions({platformName}),
func: apple.createLog({platformName: 'visionos'}),
options: apple.getLogOptions({platformName}),
};

const build = {
name: 'build-visionos',
description: 'builds your app for visionOS platform',
func: createBuild({platformName}),
func: apple.createBuild({platformName}),
examples: [
{
desc: 'Build the app for all visionOS devices in Release mode',
cmd: 'npx @callstack/react-native-visionos build-visionos --mode "Release"',
},
],
options: getBuildOptions({platformName}),
options: apple.getBuildOptions({platformName}),
};

module.exports = [run, log, build];
20 changes: 8 additions & 12 deletions packages/react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@callstack/react-native-visionos",
"version": "1000.0.0",
"version": "0.77.0-main",
"description": "React Native for visionOS",
"license": "MIT",
"repository": {
Expand Down Expand Up @@ -111,17 +111,13 @@
},
"dependencies": {
"@jest/create-cache-key-function": "^29.6.3",
"@react-native-community/cli": "14.0.0",
"@react-native-community/cli-platform-android": "14.0.0",
"@react-native-community/cli-platform-ios": "14.0.0",
"@react-native-community/cli-platform-apple": "14.0.0",
"@react-native/assets-registry": "0.76.0-main",
"@react-native/codegen": "0.76.0-main",
"@react-native/community-cli-plugin": "0.76.0-main",
"@react-native/gradle-plugin": "0.76.0-main",
"@react-native/js-polyfills": "0.76.0-main",
"@react-native/normalize-colors": "0.76.0-main",
"@react-native/virtualized-lists": "0.76.0-main",
"@react-native/assets-registry": "0.77.0-main",
"@react-native/codegen": "0.77.0-main",
"@react-native/community-cli-plugin": "0.77.0-main",
"@react-native/gradle-plugin": "0.77.0-main",
"@react-native/js-polyfills": "0.77.0-main",
"@react-native/normalize-colors": "0.77.0-main",
"@react-native/virtualized-lists": "0.77.0-main",
"abort-controller": "^3.0.0",
"anser": "^1.4.9",
"ansi-regex": "^5.0.0",
Expand Down
3 changes: 1 addition & 2 deletions packages/react-native/scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,8 @@ def use_react_native! (
pod 'DoubleConversion', :podspec => "#{prefix}/third-party-podspecs/DoubleConversion.podspec"
pod 'glog', :podspec => "#{prefix}/third-party-podspecs/glog.podspec"
pod 'boost', :podspec => "#{prefix}/third-party-podspecs/boost.podspec"
pod 'fmt', :podspec => "#{prefix}/third-party-podspecs/fmt.podspec"
pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec", :modular_headers => true
pod 'fmt', :podspec => "#{prefix}/third-party-podspecs/fmt.podspec", :modular_headers => true
pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec", :modular_headers => true

folly_config = get_folly_config()
run_codegen!(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ rescue => e
react_native_path = File.join(__dir__, "..", "..")
end

puts "React Native path: #{react_native_path}"

# package.json
package = JSON.parse(File.read(File.join(react_native_path, "package.json")))
version = package['version']
Expand Down Expand Up @@ -48,7 +46,6 @@ Pod::Spec.new do |spec|
}

spec.ios.vendored_frameworks = "destroot/Library/Frameworks/ios/hermes.framework"
spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/xros/hermes.framework"
spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework"
spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/xros/hermes.framework"

Expand Down
5 changes: 1 addition & 4 deletions packages/react-native/types/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
"jsx": "react",
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"paths": {
"react-native": ["."],
"react-native/*": ["../*"]
}
"paths": {"react-native": ["."]}
}
}
Loading

0 comments on commit 2133cbb

Please sign in to comment.