Skip to content

Commit

Permalink
chore: resync with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
okwasniewski committed Mar 6, 2024
1 parent 2b54ad9 commit 8c2c9b3
Show file tree
Hide file tree
Showing 12 changed files with 184 additions and 190 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

#if defined(__cplusplus)
#import <ReactCommon/RCTTurboModuleManager.h>
#import "RCTAppDelegate.h"

@interface RCTAppDelegate () <RCTTurboModuleManagerDelegate>
@end
#endif
22 changes: 3 additions & 19 deletions packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -7,44 +7,32 @@

#import "RCTAppDelegate.h"
#import <React/RCTColorSpaceUtils.h>
#import <React/RCTCxxBridgeDelegate.h>
#import <React/RCTLog.h>
#import <React/RCTRootView.h>
#import <React/RCTSurfacePresenterBridgeAdapter.h>
#import <React/RCTUtils.h>
#import <react/renderer/graphics/ColorComponents.h>
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import "RCTAppDelegate+Protected.h"
#import "RCTAppSetupUtils.h"
#import <React/RCTUtils.h>
#import <objc/runtime.h>

#if RN_DISABLE_OSS_PLUGIN_HEADER
#import <RCTTurboModulePlugin/RCTTurboModulePlugin.h>
#else
#import <React/CoreModulesPlugins.h>
#endif
#import <React/RCTBundleURLProvider.h>
#import <React/RCTComponentViewFactory.h>
#import <React/RCTComponentViewProtocol.h>
#import <React/RCTFabricSurface.h>
#import <React/RCTSurfaceHostingProxyRootView.h>
#import <React/RCTSurfacePresenter.h>
#import <ReactCommon/RCTContextContainerHandling.h>
#if USE_HERMES
#import <ReactCommon/RCTHermesInstance.h>
#else
#import <ReactCommon/RCTJscInstance.h>
#endif
#import <ReactCommon/RCTHost+Internal.h>
#import <ReactCommon/RCTHost.h>
#import <ReactCommon/RCTTurboModuleManager.h>
#import <react/config/ReactNativeConfig.h>
#import <react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h>
#import <react/renderer/runtimescheduler/RuntimeScheduler.h>
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
#import <react/runtime/JSRuntimeFactory.h>


@interface RCTAppDelegate () <RCTComponentViewFactoryComponentProvider>

@end

@implementation RCTAppDelegate
Expand Down Expand Up @@ -115,11 +103,7 @@ - (void)_logWarnIfCreateRootViewWithBridgeIsOverridden

- (UIViewController *)createRootViewController
{
#if TARGET_OS_VISION
return [GlassViewController new];
#else
return [UIViewController new];
#endif
}

- (void)setRootView:(UIView *)rootView toRootViewController:(UIViewController *)rootViewController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView = [[RCTSurfaceHostingProxyRootView alloc]
initWithSurface:surface
sizeMeasureMode:RCTSurfaceSizeMeasureModeWidthExact | RCTSurfaceSizeMeasureModeHeightExact];


surfaceHostingProxyRootView.backgroundColor = [UIColor clearColor];
return surfaceHostingProxyRootView;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#import <React/RCTConstants.h>
#import <React/RCTUtils.h>
#import <React/RCTRootView.h>
#import <React-RCTAppDelegate/RCTAppDelegate.h>

@protocol RCTRootViewFactoryProtocol <NSObject>

Expand Down Expand Up @@ -29,12 +30,10 @@ - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVi
[[NSNotificationCenter defaultCenter] postNotificationName:RCTWindowFrameDidChangeNotification object:self];
}

// TODO: Temporary solution for creating RCTRootView on demand. This should be done through factory pattern, see here: https://github.com/facebook/react-native/pull/42263
- (void)loadView {
id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
if ([appDelegate respondsToSelector:@selector(viewWithModuleName:initialProperties:launchOptions:)]) {
id<RCTRootViewFactoryProtocol> delegate = (id<RCTRootViewFactoryProtocol>)appDelegate;
self.view = [delegate viewWithModuleName:_moduleName initialProperties:_initialProps launchOptions:@{}];
RCTAppDelegate * appDelegate = (RCTAppDelegate *)[UIApplication sharedApplication].delegate;
if ([appDelegate respondsToSelector:@selector(rootViewFactory)]) {
self.view = [appDelegate.rootViewFactory viewWithModuleName:_moduleName initialProperties:_initialProps];
} else {
[NSException raise:@"UIApplicationDelegate:viewWithModuleName:initialProperties:launchOptions: not implemented"
format:@"Make sure you subclass RCTAppDelegate"];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/React_Codegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -45,7 +45,7 @@ Pod::Spec.new do |s|
s.dependency "React-jsi"
s.dependency "React-Core/RCTWindowManagerHeaders"

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
end
4 changes: 2 additions & 2 deletions packages/react-native/Libraries/XR/React-RCTXR.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ folly_version = folly_config[:version]

header_search_paths = [
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"${PODS_ROOT}/Headers/Public/React_Codegen/react/renderer/components\"",
]

Pod::Spec.new do |s|
Expand Down Expand Up @@ -45,7 +45,7 @@ Pod::Spec.new do |s|
s.dependency "React-jsi"
s.dependency "React-Core/RCTXRHeaders"

add_dependency(s, "React-Codegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCodegen", :additional_framework_paths => ["build/generated/ios"])
add_dependency(s, "ReactCommon", :subspec => "turbomodule/core", :additional_framework_paths => ["react/nativemodule/core"])
add_dependency(s, "React-NativeModulesApple", :additional_framework_paths => ["build/generated/ios"])
end
39 changes: 0 additions & 39 deletions packages/react-native/React/Views/RCTView.m
Original file line number Diff line number Diff line change
Expand Up @@ -667,45 +667,6 @@ - (UIEdgeInsets)bordersAsInsets
};
}


#if TARGET_OS_VISION
- (void)setHoverEffect:(NSString *)hoverEffect {
_hoverEffect = hoverEffect;

if (hoverEffect == nil) {
self.hoverStyle = nil;
return;
}

CGFloat cornerRadius = 0.0;
RCTCornerRadii cornerRadii = [self cornerRadii];

if (RCTCornerRadiiAreEqual(cornerRadii)) {
cornerRadius = cornerRadii.topLeft;

} else {
// TODO: Handle a case when corner radius is different for each corner.
cornerRadius = cornerRadii.topLeft;
}

UIShape *shape = [UIShape rectShapeWithCornerRadius:cornerRadius];
id<UIHoverEffect> effect;

if ([hoverEffect isEqualToString:@"lift"]) {
effect = [UIHoverLiftEffect effect];
} else if ([hoverEffect isEqualToString:@"highlight"]) {
effect = [UIHoverHighlightEffect effect];
}

if (effect == nil) {
self.hoverStyle = nil;
return;
}

self.hoverStyle = [UIHoverStyle styleWithEffect:effect shape:shape];
}
#endif

- (RCTCornerRadii)cornerRadii
{
const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,6 @@ BaseViewProps::BaseViewProps(
"backgroundColor",
sourceProps.backgroundColor,
{})),
#if TARGET_OS_VISION
visionos_hoverEffect(
CoreFeatures::enablePropIteratorSetter
? sourceProps.visionos_hoverEffect
: convertRawProp(
context,
rawProps,
"visionos_hoverEffect",
sourceProps.visionos_hoverEffect,
{})),
#endif
borderRadii(
CoreFeatures::enablePropIteratorSetter ? sourceProps.borderRadii
: convertRawProp(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ class BaseViewProps : public YogaStylableProps, public AccessibilityProps {

Cursor cursor{};

Cursor cursor{};

// Transform
Transform transform{};
TransformOrigin transformOrigin{
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native/sdks/hermes-engine/hermes-utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require 'net/http'
require 'rexml/document'

HERMES_GITHUB_URL = "https://github.com/callstack/hermes-visionos.git"
HERMES_GITHUB_URL = "https://github.com/facebook/hermes.git"
ENV_BUILD_FROM_SOURCE = "RCT_BUILD_HERMES_FROM_SOURCE"

module HermesEngineSourceType
Expand Down
Loading

0 comments on commit 8c2c9b3

Please sign in to comment.