diff --git a/README.md b/README.md index a99a5c75c20e3f..7b2c284cdb0ad2 100644 --- a/README.md +++ b/README.md @@ -1,147 +1,20 @@

- React Native + React Native Vision OS

Learn once, write anywhere:
- Build mobile apps with React. + Build spatial apps with React.

-

- - React Native is released under the MIT license. - - - Current CircleCI build status. - - - Current npm package version. - - - PRs welcome! - - - Follow @reactnative - -

- -

- Getting Started - · - Learn the Basics - · - Showcase - · - Contribute - · - Community - · - Support -

- -React Native brings [**React**'s][r] declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform. - -- **Declarative.** React makes it painless to create interactive UIs. Declarative views make your code more predictable and easier to debug. -- **Component-Based.** Build encapsulated components that manage their state, then compose them to make complex UIs. -- **Developer Velocity.** See local changes in seconds. Changes to JavaScript code can be live reloaded without rebuilding the native app. -- **Portability.** Reuse code across iOS, Android, and [other platforms][p]. - -React Native is developed and supported by many companies and individual core contributors. Find out more in our [ecosystem overview][e]. - -[r]: https://react.dev/ -[p]: https://reactnative.dev/docs/out-of-tree-platforms -[e]: https://github.com/facebook/react-native/blob/HEAD/ECOSYSTEM.md - -## Contents - -- [Requirements](#-requirements) -- [Building your first React Native app](#-building-your-first-react-native-app) -- [Documentation](#-documentation) -- [Upgrading](#-upgrading) -- [How to Contribute](#-how-to-contribute) -- [Code of Conduct](#code-of-conduct) -- [License](#-license) - - -## 📋 Requirements - -React Native apps may target iOS 13.4 and Android 5.0 (API 21) or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running iOS apps is limited to macOS. Tools like [Expo](https://expo.dev) can be used to work around this. - -## 🎉 Building your first React Native app - -Follow the [Getting Started guide](https://reactnative.dev/docs/getting-started). The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios: - -- [Trying out React Native][hello-world] -- [Creating a New Application][new-app] -- [Adding React Native to an Existing Application][existing] - -[hello-world]: https://snack.expo.dev/@samples/hello-world -[new-app]: https://reactnative.dev/docs/getting-started -[existing]: https://reactnative.dev/docs/integration-with-existing-apps - -## 📖 Documentation - -The full documentation for React Native can be found on our [website][docs]. - -The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the [React documentation][r-docs]. - -The source for the React Native documentation and website is hosted on a separate repo, [**@facebook/react-native-website**][repo-website]. - -[docs]: https://reactnative.dev/docs/getting-started -[r-docs]: https://react.dev/learn -[repo-website]: https://github.com/facebook/react-native-website - -## 🚀 Upgrading - -Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the [Upgrading Guide][u] for instructions. - -React Native releases are discussed [in this discussion repo](https://github.com/reactwg/react-native-releases/discussions). - -[u]: https://reactnative.dev/docs/upgrading -[repo-releases]: https://github.com/react-native-community/react-native-releases - -## 👏 How to Contribute - -The main purpose of this repository is to continue evolving React Native core. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving React Native. - -### [Code of Conduct][code] - -Facebook has adopted a Code of Conduct that we expect project participants to adhere to. -Please read the [full text][code] so that you can understand what actions will and will not be tolerated. - -[code]: https://code.fb.com/codeofconduct/ - -### [Contributing Guide][contribute] - -Read our [**Contributing Guide**][contribute] to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native. - -[contribute]: https://reactnative.dev/docs/contributing - -### [Open Source Roadmap][roadmap] - -You can learn more about our vision for React Native in the [**Roadmap**][roadmap]. - -[roadmap]: https://github.com/facebook/react-native/wiki/Roadmap - -### Good First Issues - -We have a list of [good first issues][gfi] that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process. - -[gfi]: https://github.com/facebook/react-native/labels/good%20first%20issue - -### Discussions - -Larger discussions and proposals are discussed in [**@react-native-community/discussions-and-proposals**][repo-meta]. - -[repo-meta]: https://github.com/react-native-community/discussions-and-proposals - -## 📄 License +React Native Vision OS allows you to write visionOS with full support for platform SDK. This is a full fork of the main repository with changes needed to support visionOS. -React Native is MIT licensed, as found in the [LICENSE][l] file. +This project is still at an early stage of development and is not ready for production use. -React Native documentation is Creative Commons licensed, as found in the [LICENSE-docs][ld] file. +## Contributing -[l]: https://github.com/facebook/react-native/blob/main/LICENSE -[ld]: https://github.com/facebook/react-native/blob/main/LICENSE-docs +1. Download latest Xcode beta [here](https://developer.apple.com/xcode/). +2. Install visionOS Simulator runtime. +3. Follow the same steps as for running iOS defined in [packages/rn-tester/README.md](./packages/rn-tester/README.md) diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm index 0cc46548fc2576..becba23e91f67e 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm @@ -11,6 +11,7 @@ #import #import #import "RCTAppSetupUtils.h" +#import #import "RCTLegacyInteropComponents.h" #if RCT_NEW_ARCH_ENABLED @@ -49,6 +50,21 @@ @interface RCTAppDelegate () < #endif +#if TARGET_OS_VISION +@interface GlassViewController : UIViewController + +@end + +@implementation GlassViewController + +- (UIContainerBackgroundStyle)preferredContainerBackgroundStyle { + return UIContainerBackgroundStyleGlass; +} + +@end +#endif + + static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabricEnabled) { #ifdef RCT_NEW_ARCH_ENABLED @@ -136,7 +152,14 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( rootView = [self createRootViewWithBridge:self.bridge moduleName:self.moduleName initProps:initProps]; } + + [self customizeRootView:(RCTRootView *)rootView]; +#if TARGET_OS_VISION + self.window = [[UIWindow alloc] initWithFrame:RCTForegroundWindow().bounds]; +#else self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; +#endif + UIViewController *rootViewController = [self createRootViewController]; [self setRootView:rootView toRootViewController:rootViewController]; self.window.rootViewController = rootViewController; @@ -180,7 +203,11 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge - (UIViewController *)createRootViewController { +#if TARGET_OS_VISION + return [GlassViewController new]; +#else return [UIViewController new]; +#endif } - (void)setRootView:(UIView *)rootView toRootViewController:(UIViewController *)rootViewController diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index 3d7f607b26dce2..7453c325ea748b 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -20,6 +20,7 @@ import type { AccessibilityState, AccessibilityValue, } from '../View/ViewAccessibility'; +import type {HoverEffect} from '../View/ViewPropTypes'; import {PressabilityDebugView} from '../../Pressability/PressabilityDebug'; import usePressability from '../../Pressability/usePressability'; @@ -32,12 +33,18 @@ import useAndroidRippleForView, { import * as React from 'react'; import {useImperativeHandle, useMemo, useRef, useState} from 'react'; +const defaultHoverEffect: HoverEffect = 'highlight'; + type ViewStyleProp = $ElementType, 'style'>; export type StateCallbackType = $ReadOnly<{| pressed: boolean, |}>; +type VisionOSProps = $ReadOnly<{| + visionos_hoverEffect?: ?HoverEffect, +|}>; + type Props = $ReadOnly<{| /** * Accessibility. @@ -193,6 +200,10 @@ type Props = $ReadOnly<{| * https://github.com/facebook/react-native/issues/34424 */ 'aria-label'?: ?string, + /** + * Props needed for visionOS. + */ + ...VisionOSProps, |}>; /** @@ -232,6 +243,7 @@ function Pressable(props: Props, forwardedRef): React.Node { style, testOnly_pressed, unstable_pressDelay, + visionos_hoverEffect = defaultHoverEffect, ...restProps } = props; @@ -341,7 +353,8 @@ function Pressable(props: Props, forwardedRef): React.Node { {...eventHandlers} ref={mergedRef} style={typeof style === 'function' ? style({pressed}) : style} - collapsable={false}> + collapsable={false} + visionos_hoverEffect={visionos_hoverEffect}> {typeof children === 'function' ? children({pressed}) : children} {__DEV__ ? : null} diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index f2f9c4e7829a4b..6365cd2482f333 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -9,6 +9,7 @@ */ import type {ColorValue} from '../../StyleSheet/StyleSheet'; +import type {HoverEffect} from '../View/ViewPropTypes'; import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback'; import View from '../../Components/View/View'; @@ -32,10 +33,15 @@ type IOSProps = $ReadOnly<{| hasTVPreferredFocus?: ?boolean, |}>; +type VisionOSProps = $ReadOnly<{| + hoverEffect?: ?HoverEffect, +|}>; + type Props = $ReadOnly<{| ...React.ElementConfig, ...AndroidProps, ...IOSProps, + ...VisionOSProps, activeOpacity?: ?number, underlayColor?: ?ColorValue, @@ -341,6 +347,7 @@ class TouchableHighlight extends React.Component { nextFocusLeft={this.props.nextFocusLeft} nextFocusRight={this.props.nextFocusRight} nextFocusUp={this.props.nextFocusUp} + visionos_hoverEffect={this.props.hoverEffect} focusable={ this.props.focusable !== false && this.props.onPress !== undefined } diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts index 37c4ce6df43e4c..f9b2e6a07f0df4 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts @@ -11,7 +11,7 @@ import type * as React from 'react'; import {Constructor} from '../../../types/private/Utilities'; import {TimerMixin} from '../../../types/private/TimerMixin'; import {NativeMethods} from '../../../types/public/ReactNativeTypes'; -import {TVParallaxProperties} from '../View/ViewPropTypes'; +import {HoverEffect, TVParallaxProperties} from '../View/ViewPropTypes'; import {TouchableMixin} from './Touchable'; import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback'; @@ -86,6 +86,11 @@ export interface TouchableOpacityProps * @platform android */ tvParallaxProperties?: TVParallaxProperties | undefined; + + /** + * Hover style to apply to the view. Only supported on visionOS. + */ + visionos_hoverEffect?: HoverEffect | undefined; } /** diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js index 789f0394343b11..6214a6817945ec 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js @@ -9,6 +9,7 @@ */ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; +import type {HoverEffect} from '../View/ViewPropTypes'; import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback'; import Animated from '../../Animated/Animated'; @@ -21,6 +22,8 @@ import flattenStyle from '../../StyleSheet/flattenStyle'; import Platform from '../../Utilities/Platform'; import * as React from 'react'; +const defaultHoverEffect: HoverEffect = 'highlight'; + type TVProps = $ReadOnly<{| hasTVPreferredFocus?: ?boolean, nextFocusDown?: ?number, @@ -30,9 +33,14 @@ type TVProps = $ReadOnly<{| nextFocusUp?: ?number, |}>; +type VisionOSProps = $ReadOnly<{| + visionos_hoverEffect?: ?HoverEffect, +|}>; + type Props = $ReadOnly<{| ...React.ElementConfig, ...TVProps, + ...VisionOSProps, activeOpacity?: ?number, style?: ?ViewStyleProp, @@ -130,6 +138,10 @@ type State = $ReadOnly<{| * */ class TouchableOpacity extends React.Component { + static defaultProps: {|visionos_hoverEffect: HoverEffect|} = { + visionos_hoverEffect: defaultHoverEffect, + }; + state: State = { anim: new Animated.Value(this._getChildStyleOpacityWithDefault()), pressability: new Pressability(this._createPressabilityConfig()), @@ -286,6 +298,7 @@ class TouchableOpacity extends React.Component { nextFocusUp={this.props.nextFocusUp} hasTVPreferredFocus={this.props.hasTVPreferredFocus} hitSlop={this.props.hitSlop} + visionos_hoverEffect={this.props.visionos_hoverEffect} focusable={ this.props.focusable !== false && this.props.onPress !== undefined } diff --git a/packages/react-native/Libraries/Components/View/ViewPropTypes.d.ts b/packages/react-native/Libraries/Components/View/ViewPropTypes.d.ts index 53f5e82c34149b..1e700fa925c99c 100644 --- a/packages/react-native/Libraries/Components/View/ViewPropTypes.d.ts +++ b/packages/react-native/Libraries/Components/View/ViewPropTypes.d.ts @@ -16,6 +16,8 @@ import {LayoutChangeEvent, PointerEvents} from '../../Types/CoreEventTypes'; import {Touchable} from '../Touchable/Touchable'; import {AccessibilityProps} from './ViewAccessibility'; +export type HoverEffect = 'lift' | 'highlight'; + export type TVParallaxProperties = { /** * If true, parallax effects are enabled. Defaults to true. @@ -122,6 +124,10 @@ export interface ViewPropsIOS extends TVViewPropsIOS { * Test and measure when using this property. */ shouldRasterizeIOS?: boolean | undefined; + /** + * Hover style to apply to the view. Only supported on visionOS. + */ + visionos_hoverEffect?: HoverEffect | undefined; } export interface ViewPropsAndroid { diff --git a/packages/react-native/Libraries/Components/View/ViewPropTypes.js b/packages/react-native/Libraries/Components/View/ViewPropTypes.js index 1ead9ba053a51a..e3f0229ee877d4 100644 --- a/packages/react-native/Libraries/Components/View/ViewPropTypes.js +++ b/packages/react-native/Libraries/Components/View/ViewPropTypes.js @@ -263,6 +263,8 @@ type AndroidDrawableRipple = $ReadOnly<{| rippleRadius?: ?number, |}>; +export type HoverEffect = 'lift' | 'highlight'; + type AndroidDrawable = AndroidDrawableThemeAttr | AndroidDrawableRipple; type AndroidViewProps = $ReadOnly<{| @@ -436,6 +438,11 @@ type IOSViewProps = $ReadOnly<{| * See https://reactnative.dev/docs/view#shouldrasterizeios */ shouldRasterizeIOS?: ?boolean, + + /** + * Hover style to apply to the view. Only supported on visionOS. + */ + visionos_hoverEffect?: ?HoverEffect, |}>; export type ViewProps = $ReadOnly<{| diff --git a/packages/react-native/Libraries/NativeAnimation/RCTAnimationUtils.h b/packages/react-native/Libraries/NativeAnimation/RCTAnimationUtils.h index 77152f4a5773de..562913126e9442 100644 --- a/packages/react-native/Libraries/NativeAnimation/RCTAnimationUtils.h +++ b/packages/react-native/Libraries/NativeAnimation/RCTAnimationUtils.h @@ -7,6 +7,7 @@ #import #import +#import #import diff --git a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h index e49f6ed9d54257..c5c603b5a3c519 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h +++ b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.h @@ -18,8 +18,11 @@ typedef void (^RCTRemoteNotificationCallback)(UIBackgroundFetchResult result); + (void)didReceiveRemoteNotification:(NSDictionary *)notification; + (void)didReceiveRemoteNotification:(NSDictionary *)notification fetchCompletionHandler:(RCTRemoteNotificationCallback)completionHandler; -+ (void)didReceiveLocalNotification:(UILocalNotification *)notification; -+ (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error; +#if !TARGET_OS_VISION +/** DEPRECATED. Use didReceiveNotification instead. */ ++ (void)didReceiveLocalNotification:(UILocalNotification *)notification RCT_DEPRECATED; #endif +/** DEPRECATED. Use didReceiveNotification instead. */ ++ (void)didReceiveRemoteNotification:(NSDictionary *)notification RCT_DEPRECATED; @end diff --git a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm index d0c38c91e5ac5c..ed4b95e6fd27ca 100644 --- a/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm +++ b/packages/react-native/Libraries/PushNotificationIOS/RCTPushNotificationManager.mm @@ -102,8 +102,7 @@ @interface RCTPushNotificationManager () @implementation RCTPushNotificationManager -#if !TARGET_OS_UIKITFORMAC - +#if !TARGET_OS_VISION /** DEPRECATED. UILocalNotification was deprecated in iOS 10. Please don't add new callsites. */ static NSDictionary *RCTFormatLocalNotification(UILocalNotification *notification) { @@ -123,6 +122,7 @@ @implementation RCTPushNotificationManager formattedLocalNotification[@"remote"] = @NO; return formattedLocalNotification; } +#endif /** For delivered notifications */ static NSDictionary *RCTFormatUNNotification(UNNotification *notification) @@ -258,12 +258,24 @@ + (void)didReceiveRemoteNotification:(NSDictionary *)notification userInfo:userInfo]; } +#if !TARGET_OS_VISION +// Deprecated + (void)didReceiveLocalNotification:(UILocalNotification *)notification { [[NSNotificationCenter defaultCenter] postNotificationName:kLocalNotificationReceived object:self userInfo:RCTFormatLocalNotification(notification)]; } +#endif + +// Deprecated ++ (void)didReceiveRemoteNotification:(NSDictionary *)notification +{ + NSDictionary *userInfo = @{@"notification" : notification}; + [[NSNotificationCenter defaultCenter] postNotificationName:RCTRemoteNotificationReceived + object:self + userInfo:userInfo]; +} - (void)handleLocalNotificationReceived:(NSNotification *)notification { @@ -519,15 +531,21 @@ - (void)handleRemoteNotificationRegistrationError:(NSNotification *)notification NSMutableDictionary *initialNotification = [self.bridge.launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey] mutableCopy]; - UILocalNotification *initialLocalNotification = +#if !TARGET_OS_VISION + UILocalNotification *initialLocalNotification = self.bridge.launchOptions[UIApplicationLaunchOptionsLocalNotificationKey]; - +#endif + if (initialNotification) { initialNotification[@"remote"] = @YES; resolve(initialNotification); - } else if (initialLocalNotification) { + } +#if !TARGET_OS_VISION + else if (initialLocalNotification) { resolve(RCTFormatLocalNotification(initialLocalNotification)); - } else { + } +#endif + else { resolve((id)kCFNull); } } diff --git a/packages/react-native/Libraries/Text/Text/RCTTextView.mm b/packages/react-native/Libraries/Text/Text/RCTTextView.mm index bcfb5003ee94e8..5351d5b7baaa42 100644 --- a/packages/react-native/Libraries/Text/Text/RCTTextView.mm +++ b/packages/react-native/Libraries/Text/Text/RCTTextView.mm @@ -247,17 +247,16 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture if (_editMenuInteraction) { [_editMenuInteraction presentEditMenuWithConfiguration:config]; } - return; - } - // TODO: Adopt showMenuFromRect (necessary for UIKitForMac) - UIMenuController *menuController = [UIMenuController sharedMenuController]; + } else { +#if !TARGET_OS_VISION + UIMenuController *menuController = [UIMenuController sharedMenuController]; if (menuController.isMenuVisible) { return; } - if (!self.isFirstResponder) { - [self becomeFirstResponder]; + [menuController showMenuFromView:self rect:self.bounds]; +#endif } [menuController setTargetRect:self.bounds inView:self]; diff --git a/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm b/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm index b0d71dcd3508bb..c6f15d8679bfc2 100644 --- a/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm +++ b/packages/react-native/Libraries/Text/TextInput/RCTBaseTextInputView.mm @@ -642,6 +642,7 @@ - (void)didSetProps:(NSArray *)changedProps - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID { +#if !TARGET_OS_VISION __weak RCTBaseTextInputView *weakSelf = self; [_bridge.uiManager rootViewForReactTag:self.reactTag withCompletion:^(UIView *rootView) { @@ -656,10 +657,12 @@ - (void)setCustomInputAccessoryViewWithNativeID:(NSString *)nativeID } } }]; +#endif } - (void)setDefaultInputAccessoryView { +#if !TARGET_OS_VISION UIView *textInputView = self.backedTextInputView; UIKeyboardType keyboardType = textInputView.keyboardType; @@ -691,6 +694,7 @@ - (void)setDefaultInputAccessoryView textInputView.inputAccessoryView = nil; } [self reloadInputViewsIfNecessary]; +#endif } - (void)reloadInputViewsIfNecessary diff --git a/packages/react-native/React-Core.podspec b/packages/react-native/React-Core.podspec index 78572561c8d18e..7b8b2eda2e613a 100644 --- a/packages/react-native/React-Core.podspec +++ b/packages/react-native/React-Core.podspec @@ -18,7 +18,7 @@ end folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32' folly_version = '2022.05.16.00' -socket_rocket_version = '0.6.1' +socket_rocket_version = '0.7.0.1' boost_compiler_flags = '-Wno-documentation' use_hermes = ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1' diff --git a/packages/react-native/React/Base/RCTConvert.m b/packages/react-native/React/Base/RCTConvert.m index 3a7d2b4fc35d00..ea2344b3872f0c 100644 --- a/packages/react-native/React/Base/RCTConvert.m +++ b/packages/react-native/React/Base/RCTConvert.m @@ -551,8 +551,13 @@ + (UIKeyboardType)UIKeyboardType:(id)json RCT_DYNAMIC (@{ @"default" : @(UIBarStyleDefault), @"black" : @(UIBarStyleBlack), +#if TARGET_OS_VISION + @"blackOpaque" : @(UIBarStyleBlack), + @"blackTranslucent" : @(UIBarStyleBlack), +#else @"blackOpaque" : @(UIBarStyleBlackOpaque), @"blackTranslucent" : @(UIBarStyleBlackTranslucent), +#endif }), UIBarStyleDefault, integerValue) diff --git a/packages/react-native/React/Base/RCTKeyCommands.m b/packages/react-native/React/Base/RCTKeyCommands.m index 1ceaf6ec0dceb1..2643e368afc819 100644 --- a/packages/react-native/React/Base/RCTKeyCommands.m +++ b/packages/react-native/React/Base/RCTKeyCommands.m @@ -127,8 +127,11 @@ - (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 && interactionEnabled) { UIResponder *firstResponder = nil; diff --git a/packages/react-native/React/Base/RCTUtils.h b/packages/react-native/React/Base/RCTUtils.h index dc218c47f199fc..2260a8ea4f8808 100644 --- a/packages/react-native/React/Base/RCTUtils.h +++ b/packages/react-native/React/Base/RCTUtils.h @@ -91,6 +91,14 @@ RCT_EXTERN UIApplication *__nullable RCTSharedApplication(void); // or view controller RCT_EXTERN UIWindow *__nullable RCTKeyWindow(void); +#if TARGET_OS_VISION +// Returns the current active UIWindow based on UIWindowScene +RCT_EXTERN UIWindow *__nullable RCTForegroundWindow(void); + +// Returns UIStatusBarManager to get it's configuration info. +RCT_EXTERN UIStatusBarManager *__nullable RCTUIStatusBarManager(void); +#endif + // Returns the presented view controller, useful if you need // e.g. to present a modal view controller or alert over it RCT_EXTERN UIViewController *__nullable RCTPresentedViewController(void); diff --git a/packages/react-native/React/Base/RCTUtils.m b/packages/react-native/React/Base/RCTUtils.m index da44ebce7fa758..d0d09bdb74a01f 100644 --- a/packages/react-native/React/Base/RCTUtils.m +++ b/packages/react-native/React/Base/RCTUtils.m @@ -301,18 +301,23 @@ static void RCTUnsafeExecuteOnMainQueueOnceSync(dispatch_once_t *onceToken, disp void RCTComputeScreenScale(void) { +#if !TARGET_OS_VISION dispatch_once(&onceTokenScreenScale, ^{ screenScale = [UITraitCollection currentTraitCollection].displayScale; }); +#endif } CGFloat RCTScreenScale(void) { +#if !TARGET_OS_VISION RCTUnsafeExecuteOnMainQueueOnceSync(&onceTokenScreenScale, ^{ screenScale = [UITraitCollection currentTraitCollection].displayScale; }); - return screenScale; +#endif + + return 2; } CGFloat RCTFontSizeMultiplier(void) @@ -347,9 +352,14 @@ CGSize RCTScreenSize(void) static CGSize size; static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ RCTUnsafeExecuteOnMainQueueSync(^{ +#if TARGET_OS_VISION + size = RCTKeyWindow().bounds.size; +#else size = [UIScreen mainScreen].bounds.size; +#endif }); }); @@ -565,6 +575,23 @@ BOOL RCTRunningInAppExtension(void) return nil; } +#if TARGET_OS_VISION +UIWindow *__nullable RCTForegroundWindow(void) +{ + // React native only supports single scene apps. + NSSet *scenes = RCTSharedApplication().connectedScenes; + UIWindowScene *firstScene = [scenes anyObject]; + return [[UIWindow alloc] initWithWindowScene:firstScene]; +} + +UIStatusBarManager *__nullable RCTUIStatusBarManager(void) { + NSSet *connectedScenes = RCTSharedApplication().connectedScenes; + UIWindowScene *windowScene = [connectedScenes anyObject]; + return windowScene.statusBarManager; +} + +#endif + UIViewController *__nullable RCTPresentedViewController(void) { if ([RCTUtilsUIOverride hasPresentedViewController]) { diff --git a/packages/react-native/React/CoreModules/RCTDevLoadingView.mm b/packages/react-native/React/CoreModules/RCTDevLoadingView.mm index 12736cd5297f18..9e15a4ebd43c55 100644 --- a/packages/react-native/React/CoreModules/RCTDevLoadingView.mm +++ b/packages/react-native/React/CoreModules/RCTDevLoadingView.mm @@ -119,8 +119,15 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:( CGFloat windowWidth = window.bounds.size.width; self->_window = [[UIWindow alloc] initWithWindowScene:window.windowScene]; +#if TARGET_OS_VISION + self->_window.frame = CGRectMake(0, 0, windowWidth, window.safeAreaInsets.top + 30); + self->_label = + [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top + 5, windowWidth, 20)]; +#else self->_window.frame = CGRectMake(0, 0, windowWidth, window.safeAreaInsets.top + 10); self->_label = [[UILabel alloc] initWithFrame:CGRectMake(0, window.safeAreaInsets.top - 10, windowWidth, 20)]; +#endif + [self->_window addSubview:self->_label]; self->_window.windowLevel = UIWindowLevelStatusBar + 1; @@ -139,6 +146,7 @@ - (void)showMessage:(NSString *)message color:(UIColor *)color backgroundColor:( }); [self hideBannerAfter:15.0]; + } RCT_EXPORT_METHOD(showMessage diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm index bfb49700825841..724082b67b0333 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -51,6 +51,8 @@ - (void)initialize selector:@selector(didReceiveNewContentSizeMultiplier) name:RCTAccessibilityManagerDidUpdateMultiplierNotification object:[_moduleRegistry moduleForName:"AccessibilityManager"]]; + +#if !TARGET_OS_VISION _currentInterfaceOrientation = [RCTSharedApplication() statusBarOrientation]; @@ -58,6 +60,7 @@ - (void)initialize selector:@selector(interfaceOrientationDidChange) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; +#endif _currentInterfaceDimensions = [self _exportedDimensions]; @@ -118,15 +121,16 @@ - (void)_cleanupObservers static BOOL RCTIsIPhoneNotched() { static BOOL isIPhoneNotched = NO; - static dispatch_once_t onceToken; +#if !TARGET_OS_VISION + static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - RCTAssertMainQueue(); - - // 20pt is the top safeArea value in non-notched devices - isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20; - }); + dispatch_once(&onceToken, ^{ + RCTAssertMainQueue(); + // 20pt is the top safeArea value in non-notched devices + isIPhoneNotched = RCTSharedApplication().keyWindow.safeAreaInsets.top > 20; + }); +#endif return isIPhoneNotched; } @@ -209,6 +213,7 @@ - (void)interfaceOrientationDidChange - (void)_interfaceOrientationDidChange { +#if !TARGET_OS_VISION UIApplication *application = RCTSharedApplication(); UIInterfaceOrientation nextOrientation = [application statusBarOrientation]; @@ -238,6 +243,7 @@ - (void)_interfaceOrientationDidChange _isFullscreen = isRunningInFullScreen; #pragma clang diagnostic pop } +#endif } - (void)interfaceFrameDidChange diff --git a/packages/react-native/React/CoreModules/RCTPerfMonitor.mm b/packages/react-native/React/CoreModules/RCTPerfMonitor.mm index a089054feb6fb0..d588c594bea0cb 100644 --- a/packages/react-native/React/CoreModules/RCTPerfMonitor.mm +++ b/packages/react-native/React/CoreModules/RCTPerfMonitor.mm @@ -183,7 +183,12 @@ - (UIPanGestureRecognizer *)gestureRecognizer - (UIView *)container { if (!_container) { - CGSize statusBarSize = RCTSharedApplication().statusBarFrame.size; +#if TARGET_OS_VISION + CGSize statusBarSize = RCTUIStatusBarManager().statusBarFrame.size; +#else + CGSize statusBarSize = RCTSharedApplication().statusBarFrame.size; +#endif + CGFloat statusBarHeight = statusBarSize.height; _container = [[UIView alloc] initWithFrame:CGRectMake(10, statusBarHeight, 180, RCTPerfMonitorBarHeight)]; _container.layer.borderWidth = 2; diff --git a/packages/react-native/React/CoreModules/RCTStatusBarManager.mm b/packages/react-native/React/CoreModules/RCTStatusBarManager.mm index 5d5318fb4148c7..d402cef7a94555 100644 --- a/packages/react-native/React/CoreModules/RCTStatusBarManager.mm +++ b/packages/react-native/React/CoreModules/RCTStatusBarManager.mm @@ -76,6 +76,7 @@ + (BOOL)requiresMainQueueSetup - (void)startObserving { +#if !TARGET_OS_VISION NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; [nc addObserver:self selector:@selector(applicationDidChangeStatusBarFrame:) @@ -85,6 +86,7 @@ - (void)startObserving selector:@selector(applicationWillChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; +#endif } - (void)stopObserving @@ -99,6 +101,7 @@ - (dispatch_queue_t)methodQueue - (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notification { +#if !TARGET_OS_VISION CGRect frame = [notification.userInfo[UIApplicationStatusBarFrameUserInfoKey] CGRectValue]; NSDictionary *event = @{ @"frame" : @{ @@ -109,6 +112,7 @@ - (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notifi }, }; [self sendEventWithName:eventName body:event]; +#endif } - (void)applicationDidChangeStatusBarFrame:(NSNotification *)notification @@ -123,16 +127,24 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification RCT_EXPORT_METHOD(getHeight : (RCTResponseSenderBlock)callback) { +#if !TARGET_OS_VISION callback(@[ @{ @"height" : @(RCTSharedApplication().statusBarFrame.size.height), } ]); +#else + callback(@[ @{ + @"height" : @(RCTUIStatusBarManager().statusBarFrame.size), + } ]); +#endif } RCT_EXPORT_METHOD(setStyle : (NSString *)style animated : (BOOL)animated) { - UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style]; - if (RCTViewControllerBasedStatusBarAppearance()) { - RCTLogError(@"RCTStatusBarManager module requires that the \ +#if !TARGET_OS_VISION + dispatch_async(dispatch_get_main_queue(), ^{ + UIStatusBarStyle statusBarStyle = [RCTConvert UIStatusBarStyle:style]; + if (RCTViewControllerBasedStatusBarAppearance()) { + RCTLogError(@"RCTStatusBarManager module requires that the \ UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO"); } else { #pragma clang diagnostic push @@ -140,25 +152,33 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification [RCTSharedApplication() setStatusBarStyle:statusBarStyle animated:animated]; } #pragma clang diagnostic pop + }); +#endif } RCT_EXPORT_METHOD(setHidden : (BOOL)hidden withAnimation : (NSString *)withAnimation) { - UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation]; - if (RCTViewControllerBasedStatusBarAppearance()) { - RCTLogError(@"RCTStatusBarManager module requires that the \ +#if !TARGET_OS_VISION + dispatch_async(dispatch_get_main_queue(), ^{ + UIStatusBarAnimation animation = [RCTConvert UIStatusBarAnimation:withAnimation]; + if (RCTViewControllerBasedStatusBarAppearance()) { + RCTLogError(@"RCTStatusBarManager module requires that the \ UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO"); } else { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" [RCTSharedApplication() setStatusBarHidden:hidden withAnimation:animation]; #pragma clang diagnostic pop - } + } + }); +#endif } RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible : (BOOL)visible) { - RCTSharedApplication().networkActivityIndicatorVisible = visible; +#if !TARGET_OS_VISION + RCTSharedApplication().networkActivityIndicatorVisible = visible; +#endif } - (facebook::react::ModuleConstants)getConstants @@ -166,7 +186,11 @@ - (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification __block facebook::react::ModuleConstants constants; RCTUnsafeExecuteOnMainQueueSync(^{ constants = facebook::react::typedConstants({ +#if TARGET_OS_VISION + .HEIGHT = RCTUIStatusBarManager().statusBarFrame.size.height, +#else .HEIGHT = RCTSharedApplication().statusBarFrame.size.height, +#endif .DEFAULT_BACKGROUND_COLOR = std::nullopt, }); }); diff --git a/packages/react-native/React/CoreModules/React-CoreModules.podspec b/packages/react-native/React/CoreModules/React-CoreModules.podspec index d72c74cdbdc46a..8c38dd6aacfbf3 100644 --- a/packages/react-native/React/CoreModules/React-CoreModules.podspec +++ b/packages/react-native/React/CoreModules/React-CoreModules.podspec @@ -18,7 +18,7 @@ end folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32' folly_version = '2022.05.16.00' -socket_rocket_version = '0.6.1' +socket_rocket_version = '0.7.0.1' header_search_paths = [ "\"$(PODS_TARGET_SRCROOT)/React/CoreModules\"", diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm index 454c3ff1ac279d..957c610b89bbfd 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm @@ -67,7 +67,9 @@ - (void)didMoveToWindow if (self.window && !_textInput) { if (self.nativeId) { _textInput = RCTFindTextInputWithNativeId(self.window, self.nativeId); +#if !TARGET_OS_VISION _textInput.inputAccessoryView = _contentView; +#endif } else { _textInput = RCTFindTextInputWithNativeId(_contentView, nil); } @@ -83,10 +85,12 @@ - (BOOL)canBecomeFirstResponder return true; } +#if !TARGET_OS_VISION - (UIView *)inputAccessoryView { return _contentView; } +#endif #pragma mark - RCTComponentViewProtocol diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm index db5b92fb8f48e4..f0881fd9541628 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm @@ -44,7 +44,11 @@ - (void)loadView - (UIStatusBarStyle)preferredStatusBarStyle { +#if !TARGET_OS_VISION return [RCTSharedApplication() statusBarStyle]; +#else + return UIStatusBarStyleDefault; +#endif } - (void)viewDidDisappear:(BOOL)animated @@ -55,14 +59,23 @@ - (void)viewDidDisappear:(BOOL)animated - (BOOL)prefersStatusBarHidden { +#if !TARGET_OS_VISION return [RCTSharedApplication() isStatusBarHidden]; +#else + return false; +#endif } #if RCT_DEV - (UIInterfaceOrientationMask)supportedInterfaceOrientations { +#if !TARGET_OS_VISION UIInterfaceOrientationMask appSupportedOrientationsMask = [RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]]; +#else + UIInterfaceOrientationMask appSupportedOrientationsMask = UIInterfaceOrientationMaskPortrait; +#endif + if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) { RCTLogError( @"Modal was presented with 0x%x orientations mask but the application only supports 0x%x." diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm index 504b0ef147ae0b..3a765dd7c7d02c 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm @@ -28,6 +28,7 @@ static const CGFloat kClippingLeeway = 44.0; +#if !TARGET_OS_VISION static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(const ScrollViewProps &props) { switch (props.keyboardDismissMode) { @@ -39,6 +40,7 @@ static UIScrollViewKeyboardDismissMode RCTUIKeyboardDismissModeFromProps(const S return UIScrollViewKeyboardDismissModeInteractive; } } +#endif static UIScrollViewIndicatorStyle RCTUIScrollViewIndicatorStyleFromProps(const ScrollViewProps &props) { @@ -299,9 +301,11 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & MAP_SCROLL_VIEW_PROP(disableIntervalMomentum); MAP_SCROLL_VIEW_PROP(snapToInterval); +#if !TARGET_OS_VISION if (oldScrollViewProps.keyboardDismissMode != newScrollViewProps.keyboardDismissMode) { scrollView.keyboardDismissMode = RCTUIKeyboardDismissModeFromProps(newScrollViewProps); } +#endif [super updateProps:props oldProps:oldProps]; } diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm index fce427848a9c11..c5fed4c6b4871d 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/Text/RCTParagraphComponentView.mm @@ -244,17 +244,16 @@ - (void)handleLongPress:(UILongPressGestureRecognizer *)gesture if (_editMenuInteraction) { [_editMenuInteraction presentEditMenuWithConfiguration:config]; } - return; - } - // TODO: Adopt showMenuFromRect (necessary for UIKitForMac) - UIMenuController *menuController = [UIMenuController sharedMenuController]; + } else { +#if !TARGET_OS_VISION + UIMenuController *menuController = [UIMenuController sharedMenuController]; if (menuController.isMenuVisible) { return; } - if (!self.isFirstResponder) { - [self becomeFirstResponder]; + [menuController showMenuFromView:self rect:self.bounds]; +#endif } [menuController setTargetRect:self.bounds inView:self]; diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index e7b69bff2f9e68..a1ec3dce785e0d 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -475,6 +475,7 @@ - (void)setTextAndSelection:(NSInteger)eventCount - (void)setDefaultInputAccessoryView { +#if !TARGET_OS_VISION // InputAccessoryView component sets the inputAccessoryView when inputAccessoryViewID exists if (_backedTextInputView.inputAccessoryViewID) { if (_backedTextInputView.isFirstResponder) { @@ -514,6 +515,7 @@ - (void)setDefaultInputAccessoryView if (_backedTextInputView.isFirstResponder) { [_backedTextInputView reloadInputViews]; } +#endif } - (void)handleInputAccessoryDoneButton diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm index d4b91c921b1114..3bc3f3a298e47f 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputUtils.mm @@ -26,7 +26,9 @@ void RCTCopyBackedTextInput( toTextInput.placeholder = fromTextInput.placeholder; toTextInput.placeholderColor = fromTextInput.placeholderColor; toTextInput.textContainerInset = fromTextInput.textContainerInset; +#if !TARGET_OS_VISION toTextInput.inputAccessoryView = fromTextInput.inputAccessoryView; +#endif toTextInput.textInputDelegate = fromTextInput.textInputDelegate; toTextInput.placeholderColor = fromTextInput.placeholderColor; toTextInput.defaultTextAttributes = fromTextInput.defaultTextAttributes; diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm index c0aed8087b8028..d3015f7061dc4b 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm @@ -289,6 +289,12 @@ - (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared & oldViewProps.borderColors != newViewProps.borderColors) { needsInvalidateLayer = YES; } + +#if TARGET_OS_VISION + if (oldViewProps.visionos_hoverEffect != newViewProps.visionos_hoverEffect) { + [self updateHoverEffect:[NSString stringWithUTF8String:newViewProps.visionos_hoverEffect.c_str()]]; + } +#endif // `nativeId` if (oldViewProps.nativeId != newViewProps.nativeId) { @@ -509,6 +515,28 @@ - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event } } +#if TARGET_OS_VISION +- (void) updateHoverEffect:(NSString*)hoverEffect { + if (hoverEffect == nil || [hoverEffect isEqualToString:@""]) { + self.hoverStyle = nil; + return; + } + + UIShape *shape = [UIShape rectShapeWithCornerRadius:self.layer.cornerRadius]; + id effect; + + if ([hoverEffect isEqualToString:@"lift"]) { + effect = [UIHoverLiftEffect effect]; + } else if ([hoverEffect isEqualToString:@"highlight"]) { + effect = [UIHoverHighlightEffect effect]; + } + + if (hoverEffect != nil) { + self.hoverStyle = [UIHoverStyle styleWithEffect:effect shape:shape]; + } +} +#endif + static RCTCornerRadii RCTCornerRadiiFromBorderRadii(BorderRadii borderRadii) { return RCTCornerRadii{ diff --git a/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm b/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm index 67a89beac124b2..b70c5f59563cea 100644 --- a/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm +++ b/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm @@ -281,6 +281,7 @@ static PointerEvent CreatePointerEventFromActivePointer( UIView *rootComponentView) { PointerEvent event = {}; +#if !TARGET_OS_VISION event.pointerId = activePointer.identifier; event.pointerType = PointerTypeCStringFromUITouchType(activePointer.touchType); @@ -329,7 +330,7 @@ static PointerEvent CreatePointerEventFromActivePointer( event.tangentialPressure = 0.0; event.twist = 0; event.isPrimary = activePointer.isPrimary; - +#endif return event; } @@ -369,6 +370,7 @@ static void UpdateActivePointerWithUITouch( UIEvent *uiEvent, UIView *rootComponentView) { +#if !TARGET_OS_VISION CGPoint location = [uiTouch locationInView:rootComponentView]; UIView *hitTestedView = [rootComponentView hitTest:location withEvent:nil]; activePointer.componentView = FindClosestFabricManagedTouchableView(hitTestedView); @@ -394,6 +396,7 @@ static void UpdateActivePointerWithUITouch( activePointer.button = ButtonMaskDiffToButton(activePointer.buttonMask, nextButtonMask); activePointer.buttonMask = nextButtonMask; activePointer.modifierFlags = uiEvent.modifierFlags; +#endif } /** @@ -747,6 +750,7 @@ - (void)hovering:(UIHoverGestureRecognizer *)recognizer pointerId:(int)pointerId pointerType:(std::string)pointerType API_AVAILABLE(ios(13.0)) { +#if !TARGET_OS_VISION UIView *listenerView = recognizer.view; CGPoint clientLocation = [recognizer locationInView:listenerView]; CGPoint screenLocation = [listenerView convertPoint:clientLocation @@ -769,6 +773,7 @@ - (void)hovering:(UIHoverGestureRecognizer *)recognizer if (eventEmitter != nil) { eventEmitter->onPointerMove(event); } +#endif } #pragma mark - Shared pointer handlers diff --git a/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm b/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm index a793251fc622c3..51e4a14e026f59 100644 --- a/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm +++ b/packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm @@ -54,6 +54,7 @@ static void UpdateActiveTouchWithUITouch( UIView *rootComponentView, CGPoint rootViewOriginOffset) { +#if !TARGET_OS_VISION CGPoint offsetPoint = [uiTouch locationInView:activeTouch.componentView]; CGPoint pagePoint = [uiTouch locationInView:rootComponentView]; CGPoint screenPoint = [rootComponentView convertPoint:pagePoint @@ -69,6 +70,7 @@ static void UpdateActiveTouchWithUITouch( if (RCTForceTouchAvailable()) { activeTouch.touch.force = RCTZeroIfNaN(uiTouch.force / uiTouch.maximumPossibleForce); } +#endif } static ActiveTouch CreateTouchWithUITouch(UITouch *uiTouch, UIView *rootComponentView, CGPoint rootViewOriginOffset) diff --git a/packages/react-native/React/Modules/RCTUIManager.m b/packages/react-native/React/Modules/RCTUIManager.m index 1a29de0009d811..22f649dbd12d27 100644 --- a/packages/react-native/React/Modules/RCTUIManager.m +++ b/packages/react-native/React/Modules/RCTUIManager.m @@ -189,10 +189,12 @@ - (void)setBridge:(RCTBridge *)bridge name:@"RCTAccessibilityManagerDidUpdateMultiplierNotification" object:a11yManager]; }); +#if !TARGET_OS_VISION [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(namedOrientationDidChange) name:UIDeviceOrientationDidChangeNotification object:nil]; +#endif [RCTLayoutAnimation initializeStatics]; } @@ -260,16 +262,17 @@ - (void)didReceiveNewContentSizeMultiplier - (void)namedOrientationDidChange { +#if !TARGET_OS_VISION NSDictionary *orientationEvent = deviceOrientationEventBody([UIDevice currentDevice].orientation); if (!orientationEvent) { return; } - #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" [[_moduleRegistry moduleForName:"EventDispatcher"] sendDeviceEventWithName:@"namedOrientationDidChange" body:orientationEvent]; #pragma clang diagnostic pop +#endif } - (dispatch_queue_t)methodQueue diff --git a/packages/react-native/React/UIUtils/RCTUIUtils.m b/packages/react-native/React/UIUtils/RCTUIUtils.m index efc30048d6467d..6f706d9d6ebd2e 100644 --- a/packages/react-native/React/UIUtils/RCTUIUtils.m +++ b/packages/react-native/React/UIUtils/RCTUIUtils.m @@ -11,18 +11,27 @@ RCTDimensions RCTGetDimensions(CGFloat fontScale) { +#if TARGET_OS_VISION + CGSize screenSize = RCTForegroundWindow().bounds.size; +#else UIScreen *mainScreen = UIScreen.mainScreen; CGSize screenSize = mainScreen.bounds.size; - +#endif UIView *mainWindow = RCTKeyWindow(); // We fallback to screen size if a key window is not found. CGSize windowSize = mainWindow ? mainWindow.bounds.size : screenSize; + CGFloat scale; +#if TARGET_OS_VISION + scale = 2; +#else + scale = mainScreen.scale; +#endif RCTDimensions result; typeof(result.screen) dimsScreen = { - .width = screenSize.width, .height = screenSize.height, .scale = mainScreen.scale, .fontScale = fontScale}; + .width = screenSize.width, .height = screenSize.height, .scale = scale, .fontScale = fontScale}; typeof(result.window) dimsWindow = { - .width = windowSize.width, .height = windowSize.height, .scale = mainScreen.scale, .fontScale = fontScale}; + .width = windowSize.width, .height = windowSize.height, .scale = scale, .fontScale = fontScale}; result.screen = dimsScreen; result.window = dimsWindow; diff --git a/packages/react-native/React/Views/RCTModalHostView.m b/packages/react-native/React/Views/RCTModalHostView.m index dfde4ae47ab137..9694d67e8e1d0b 100644 --- a/packages/react-native/React/Views/RCTModalHostView.m +++ b/packages/react-native/React/Views/RCTModalHostView.m @@ -75,8 +75,11 @@ - (void)notifyForOrientationChange if (!_onOrientationChange) { return; } - +#if !TARGET_OS_VISION UIInterfaceOrientation currentOrientation = [RCTSharedApplication() statusBarOrientation]; +#else + UIInterfaceOrientation currentOrientation = UIDeviceOrientationUnknown; +#endif if (currentOrientation == _lastKnownOrientation) { return; } diff --git a/packages/react-native/React/Views/RCTModalHostViewController.m b/packages/react-native/React/Views/RCTModalHostViewController.m index 059b64157f9836..973367c567ed0d 100644 --- a/packages/react-native/React/Views/RCTModalHostViewController.m +++ b/packages/react-native/React/Views/RCTModalHostViewController.m @@ -23,10 +23,11 @@ - (instancetype)init } self.modalInPresentation = YES; - +#if !TARGET_OS_VISION _preferredStatusBarStyle = [RCTSharedApplication() statusBarStyle]; _preferredStatusBarHidden = [RCTSharedApplication() isStatusBarHidden]; - +#endif + return self; } @@ -53,8 +54,12 @@ - (BOOL)prefersStatusBarHidden #if RCT_DEV - (UIInterfaceOrientationMask)supportedInterfaceOrientations { +#if !TARGET_OS_VISION UIInterfaceOrientationMask appSupportedOrientationsMask = [RCTSharedApplication() supportedInterfaceOrientationsForWindow:[RCTSharedApplication() keyWindow]]; +#else + UIInterfaceOrientationMask appSupportedOrientationsMask = UIInterfaceOrientationMaskPortrait; +#endif if (!(_supportedInterfaceOrientations & appSupportedOrientationsMask)) { RCTLogError( @"Modal was presented with 0x%x orientations mask but the application only supports 0x%x." diff --git a/packages/react-native/React/Views/RCTView.h b/packages/react-native/React/Views/RCTView.h index 200d8b451bf59e..100cde3079f5c9 100644 --- a/packages/react-native/React/Views/RCTView.h +++ b/packages/react-native/React/Views/RCTView.h @@ -120,6 +120,13 @@ extern const UIAccessibilityTraits SwitchAccessibilityTrait; */ @property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets; +#if TARGET_OS_VISION +/** + * The hover style to apply to a view, including an effect and a shape to use for displaying that effect. + */ +@property (nonatomic, copy) NSString *hoverEffect; +#endif + /** * (Experimental and unused for Paper) Pointer event handlers. */ diff --git a/packages/react-native/React/Views/RCTView.m b/packages/react-native/React/Views/RCTView.m index bb8336615a0208..821a5b1a1981a4 100644 --- a/packages/react-native/React/Views/RCTView.m +++ b/packages/react-native/React/Views/RCTView.m @@ -666,6 +666,31 @@ - (UIEdgeInsets)bordersAsInsets }; } + +#if TARGET_OS_VISION +- (void)setHoverEffect:(NSString *)hoverEffect { + _hoverEffect = hoverEffect; + + if (hoverEffect == nil) { + self.hoverStyle = nil; + return; + } + + UIShape *shape = [UIShape rectShapeWithCornerRadius:_borderRadius]; + id effect; + + if ([hoverEffect isEqualToString:@"lift"]) { + effect = [UIHoverLiftEffect effect]; + } else if ([hoverEffect isEqualToString:@"highlight"]) { + effect = [UIHoverHighlightEffect effect]; + } + + if (hoverEffect != nil) { + self.hoverStyle = [UIHoverStyle styleWithEffect:effect shape:shape]; + } +} +#endif + - (RCTCornerRadii)cornerRadii { const BOOL isRTL = _reactLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; diff --git a/packages/react-native/React/Views/RCTViewManager.h b/packages/react-native/React/Views/RCTViewManager.h index 1676e69f2aca86..9cde0f096d513d 100644 --- a/packages/react-native/React/Views/RCTViewManager.h +++ b/packages/react-native/React/Views/RCTViewManager.h @@ -79,6 +79,25 @@ typedef void (^RCTViewManagerUIBlock)(RCTUIManager *uiManager, NSDictionary #import +#if !TARGET_OS_VISION + @interface RCTConvert (UIScrollView) + (UIScrollViewKeyboardDismissMode)UIScrollViewKeyboardDismissMode:(id)json; @end +#endif + @interface RCTScrollViewManager : RCTViewManager @end + + diff --git a/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m b/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m index 03355504e0a1dc..ccb25b9cc31164 100644 --- a/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m +++ b/packages/react-native/React/Views/ScrollView/RCTScrollViewManager.m @@ -12,8 +12,11 @@ #import "RCTShadowView.h" #import "RCTUIManager.h" +#if !TARGET_OS_VISION + @implementation RCTConvert (UIScrollView) +#if !TARGET_OS_VISION RCT_ENUM_CONVERTER( UIScrollViewKeyboardDismissMode, (@{ @@ -25,6 +28,7 @@ @implementation RCTConvert (UIScrollView) }), UIScrollViewKeyboardDismissModeNone, integerValue) +#endif RCT_ENUM_CONVERTER( UIScrollViewIndicatorStyle, @@ -49,6 +53,7 @@ @implementation RCTConvert (UIScrollView) @end + @implementation RCTScrollViewManager RCT_EXPORT_MODULE() @@ -70,7 +75,7 @@ - (UIView *)view RCT_EXPORT_VIEW_PROPERTY(decelerationRate, CGFloat) RCT_EXPORT_VIEW_PROPERTY(directionalLockEnabled, BOOL) RCT_EXPORT_VIEW_PROPERTY(indicatorStyle, UIScrollViewIndicatorStyle) -RCT_EXPORT_VIEW_PROPERTY(keyboardDismissMode, UIScrollViewKeyboardDismissMode) +RCT_EXPORT_NOT_VISIONOS_VIEW_PROPERTY(keyboardDismissMode, UIScrollViewKeyboardDismissMode) RCT_EXPORT_VIEW_PROPERTY(maximumZoomScale, CGFloat) RCT_EXPORT_VIEW_PROPERTY(minimumZoomScale, CGFloat) RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) diff --git a/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm b/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm index 8a286dcfd33665..c6650e53f6b356 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm +++ b/packages/react-native/ReactCommon/react/nativemodule/samples/platform/ios/ReactCommon/RCTSampleTurboModule.mm @@ -46,12 +46,18 @@ - (NSDictionary *)getConstants { __block NSDictionary *constants; RCTUnsafeExecuteOnMainQueueSync(^{ - UIScreen *mainScreen = UIScreen.mainScreen; - CGSize screenSize = mainScreen.bounds.size; - +#if TARGET_OS_VISION + UIApplication *app = [[UIApplication class] performSelector:@selector(sharedApplication)]; + UIWindowScene *scene = (UIWindowScene*)[app.connectedScenes anyObject]; + UIWindow *window = [[UIWindow alloc] initWithWindowScene:scene]; + CGSize screenSize = window.bounds.size; +#else + UIScreen *mainScreen = UIScreen.mainScreen; + CGSize screenSize = mainScreen.bounds.size; +#endif constants = @{ @"const1" : @YES, - @"const2" : @(screenSize.width), + @"const2" : @(screenSize), @"const3" : @"something", }; }); diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp index 58bb38b20385c1..22fa01d7170cae 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp +++ b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.cpp @@ -71,6 +71,17 @@ 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( @@ -281,6 +292,9 @@ void BaseViewProps::setProp( RAW_SET_PROP_SWITCH_CASE_BASIC(collapsable); RAW_SET_PROP_SWITCH_CASE_BASIC(removeClippedSubviews); RAW_SET_PROP_SWITCH_CASE_BASIC(experimental_layoutConformance); +#if TARGET_OS_VISION + RAW_SET_PROP_SWITCH_CASE_BASIC(visionos_hoverEffect); +#endif // events field VIEW_EVENT_CASE(PointerEnter); VIEW_EVENT_CASE(PointerEnterCapture); diff --git a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h index b7bdd9afc7eb55..a70e8c578e8b9a 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h +++ b/packages/react-native/ReactCommon/react/renderer/components/view/BaseViewProps.h @@ -63,6 +63,10 @@ class BaseViewProps : public YogaStylableProps, public AccessibilityProps { PointerEventsMode pointerEvents{}; EdgeInsets hitSlop{}; bool onLayout{}; + +#if TARGET_OS_VISION + std::string visionos_hoverEffect{}; +#endif ViewEvents events{}; diff --git a/packages/react-native/scripts/cocoapods/helpers.rb b/packages/react-native/scripts/cocoapods/helpers.rb index 4a46189002286b..e60b34380ccc7c 100644 --- a/packages/react-native/scripts/cocoapods/helpers.rb +++ b/packages/react-native/scripts/cocoapods/helpers.rb @@ -40,5 +40,16 @@ class Constants def self.min_ios_version_supported return '13.4' end + + def self.min_visionos_version_supported + return '1.0' + end + + def self.folly_config + return { + :version => '2024.01.01.00', + :compiler_flags => '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32' + } + end end end diff --git a/packages/react-native/scripts/react_native_pods.rb b/packages/react-native/scripts/react_native_pods.rb index 01e68b50a47e91..e5fabfdac9b160 100644 --- a/packages/react-native/scripts/react_native_pods.rb +++ b/packages/react-native/scripts/react_native_pods.rb @@ -41,11 +41,15 @@ def min_ios_version_supported return Helpers::Constants.min_ios_version_supported end +def min_visionos_version_supported + return Helpers::Constants.min_visionos_version_supported +end + # This function returns the min supported OS versions supported by React Native # By using this function, you won't have to manually change your Podfile # when we change the minimum version supported by the framework. def min_supported_versions - return { :ios => min_ios_version_supported } + return { :ios => min_ios_version_supported, :visionos => min_visionos_version_supported } end # This function prepares the project for React Native, before processing @@ -156,6 +160,10 @@ def use_react_native! ( pod 'glog', :podspec => "#{prefix}/third-party-podspecs/glog.podspec" pod 'boost', :podspec => "#{prefix}/third-party-podspecs/boost.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 'SocketRocket', :podspec => "#{prefix}/third-party-podspecs/SocketRocket.podspec", :modular_headers => true + # pod 'YogaKit', :podspec => "#{prefix}/third-party-podspecs/YogaKit.podspec", :modular_headers => true + run_codegen!( app_path, diff --git a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec index ab678e142c6511..bffce5618eeaf8 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-engine.podspec +++ b/packages/react-native/sdks/hermes-engine/hermes-engine.podspec @@ -24,7 +24,7 @@ Pod::Spec.new do |spec| spec.license = package['license'] spec.author = "Facebook" spec.source = source - spec.platforms = { :osx => "10.13", :ios => "13.4" } + spec.platforms = { :osx => "10.13", :ios => "13.4", :visionos => "1.0" } spec.preserve_paths = '**/*.*' spec.source_files = '' @@ -35,6 +35,7 @@ Pod::Spec.new do |spec| } spec.ios.vendored_frameworks = "destroot/Library/Frameworks/ios/hermes.framework" + spec.visionos.vendored_frameworks = "destroot/Library/Frameworks/visionos/hermes.framework" spec.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework" if HermesEngineSourceType::isPrebuilt(source_type) then @@ -44,6 +45,7 @@ Pod::Spec.new do |spec| ss.source_files = "destroot/include/hermes/**/*.h" ss.header_mappings_dir = "destroot/include" ss.ios.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework" + ss.visionos.vendored_frameworks = "destroot/Library/Frameworks/universal/hermes.xcframework" ss.osx.vendored_frameworks = "destroot/Library/Frameworks/macosx/hermes.framework" end diff --git a/packages/react-native/third-party-podspecs/SocketRocket.podspec b/packages/react-native/third-party-podspecs/SocketRocket.podspec new file mode 100644 index 00000000000000..7e65ab07b1710a --- /dev/null +++ b/packages/react-native/third-party-podspecs/SocketRocket.podspec @@ -0,0 +1,21 @@ +Pod::Spec.new do |s| + s.name = 'SocketRocket' + s.version = '0.7.0.1' + s.summary = 'A conforming WebSocket (RFC 6455) client library for iOS, macOS and tvOS.' + s.homepage = 'https://github.com/facebook/SocketRocket' + s.authors = { 'Nikita Lutsenko' => 'nlutsenko@me.com', 'Dan Federman' => 'federman@squareup.com', 'Mike Lewis' => 'mikelikespie@gmail.com' } + s.license = 'BSD' + s.source = { :git => 'https://github.com/facebook/SocketRocket.git', :tag => '0.7.0' } + s.requires_arc = true + + s.source_files = 'SocketRocket/**/*.{h,m}' + s.public_header_files = 'SocketRocket/*.h' + + s.platforms = min_supported_versions + + s.ios.frameworks = 'CFNetwork', 'Security' + s.osx.frameworks = 'CoreServices', 'Security' + s.tvos.frameworks = 'CFNetwork', 'Security' + s.visionos.frameworks = 'CFNetwork', 'Security' + s.libraries = 'icucore' + end \ No newline at end of file diff --git a/packages/react-native/third-party-podspecs/YogaKit.podspec b/packages/react-native/third-party-podspecs/YogaKit.podspec new file mode 100644 index 00000000000000..febbb126ee9302 --- /dev/null +++ b/packages/react-native/third-party-podspecs/YogaKit.podspec @@ -0,0 +1,39 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +podspec = Pod::Spec.new do |spec| + spec.name = 'YogaKit' + spec.version = '1.18.1' + spec.license = { :type => 'MIT', :file => "LICENSE" } + spec.homepage = 'https://facebook.github.io/yoga/' + spec.documentation_url = 'https://facebook.github.io/yoga/docs/' + + spec.summary = 'Yoga is a cross-platform layout engine which implements Flexbox.' + spec.description = 'Yoga is a cross-platform layout engine enabling maximum collaboration within your team by implementing an API many designers are familiar with, and opening it up to developers across different platforms.' + + spec.authors = 'Facebook' + spec.source = { + :git => 'https://github.com/facebook/yoga.git', + :tag => "1.18.0", + } + + spec.platforms = min_supported_versions + spec.ios.deployment_target = '8.0' + spec.ios.frameworks = 'UIKit' + spec.module_name = 'YogaKit' + spec.dependency 'Yoga' + # Fixes the bug related the xcode 11 not able to find swift related frameworks. + # https://github.com/Carthage/Carthage/issues/2825 + # https://twitter.com/krzyzanowskim/status/1151549874653081601?s=21 + spec.pod_target_xcconfig = {"LD_VERIFY_BITCODE": "NO"} + spec.source_files = 'YogaKit/Source/*.{h,m,swift}' + spec.public_header_files = 'YogaKit/Source/{YGLayout,UIView+Yoga}.h' + spec.private_header_files = 'YogaKit/Source/YGLayout+Private.h' + spec.swift_version = '5.1' + end + + # See https://github.com/facebook/yoga/pull/366 + podspec.attributes_hash["readme"] = "YogaKit/README.md" + podspec \ No newline at end of file diff --git a/packages/react-native/third-party-podspecs/libevent.podspec b/packages/react-native/third-party-podspecs/libevent.podspec new file mode 100644 index 00000000000000..c917f0227be3fd --- /dev/null +++ b/packages/react-native/third-party-podspecs/libevent.podspec @@ -0,0 +1,560 @@ +# Copyright (c) Meta Platforms, Inc. and affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +# Generated with: +# +# $ mkdir build && cd build +# $ cmake -G Ninja .. \ +# -DEVENT__DISABLE_OPENSSL:BOOL=ON \ +# -DEVENT__DISABLE_BENCHMARK:BOOL=ON \ +# -DEVENT__DISABLE_TESTS:BOOL=ON \ +# -DEVENT__DISABLE_REGRESS:BOOL=ON \ +# -DEVENT__DISABLE_SAMPLES:BOOL=ON +# $ cat include/event2/event-config.h +# +CONFIG_WITHOUT_OPENSSL = <<-END_OF_CONFIG +/* event-config.h + * + * This file was generated by cmake when the makefiles were generated. + * + * DO NOT EDIT THIS FILE. + * + * Do not rely on macros in this file existing in later versions. + */ +#ifndef EVENT2_EVENT_CONFIG_H_INCLUDED_ +#define EVENT2_EVENT_CONFIG_H_INCLUDED_ + +/* Numeric representation of the version */ +#define EVENT__NUMERIC_VERSION 0x02020001 +#define EVENT__PACKAGE_VERSION "2.2.0" + +#define EVENT__VERSION_MAJOR 2 +#define EVENT__VERSION_MINOR 2 +#define EVENT__VERSION_PATCH 0 + +/* Version number of package */ +#define EVENT__VERSION "2.2.0-alpha-dev" + +/* Name of package */ +#define EVENT__PACKAGE "libevent" + +/* Define to the address where bug reports for this package should be sent. */ +#define EVENT__PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define EVENT__PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define EVENT__PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define EVENT__PACKAGE_TARNAME "" + +/* Define if libevent should build without support for a debug mode */ +/* #undef EVENT__DISABLE_DEBUG_MODE */ + +/* Define if libevent should not allow replacing the mm functions */ +/* #undef EVENT__DISABLE_MM_REPLACEMENT */ + +/* Define if libevent should not be compiled with thread support */ +/* #undef EVENT__DISABLE_THREAD_SUPPORT */ + +/* Define to 1 if you have the `accept4' function. */ +/* #undef EVENT__HAVE_ACCEPT4 */ + +/* Define to 1 if you have the `arc4random' function. */ +#define EVENT__HAVE_ARC4RANDOM 1 + +/* Define to 1 if you have the `arc4random_buf' function. */ +#define EVENT__HAVE_ARC4RANDOM_BUF 1 + +/* Define to 1 if you have the `arc4random_addrandom' function. */ +#define EVENT__HAVE_ARC4RANDOM_ADDRANDOM 1 + +/* Define if clock_gettime is available in libc */ +#define EVENT__DNS_USE_CPU_CLOCK_FOR_ID 1 + +/* Define is no secure id variant is available */ +/* #undef EVENT__DNS_USE_GETTIMEOFDAY_FOR_ID */ +/* #undef EVENT__DNS_USE_FTIME_FOR_ID */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define EVENT__HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the declaration of `CTL_KERN'. */ +#define EVENT__HAVE_DECL_CTL_KERN 1 + +/* Define to 1 if you have the declaration of `KERN_ARND'. */ +#define EVENT__HAVE_DECL_KERN_ARND 0 + +/* Define to 1 if you have `getrandom' function. */ +/* #undef EVENT__HAVE_GETRANDOM */ + +/* Define if /dev/poll is available */ +/* #undef EVENT__HAVE_DEVPOLL */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_NETDB_H 1 + +/* Define to 1 if fd_mask type is defined */ +#define EVENT__HAVE_FD_MASK 1 + +/* Define to 1 if the header file defines TAILQ_FOREACH. */ +#define EVENT__HAVE_TAILQFOREACH 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_DLFCN_H 1 + +/* Define if your system supports the epoll system calls */ +/* #undef EVENT__HAVE_EPOLL */ + +/* Define to 1 if you have the `epoll_create1' function. */ +/* #undef EVENT__HAVE_EPOLL_CREATE1 */ + +/* Define to 1 if you have the `epoll_ctl' function. */ +/* #undef EVENT__HAVE_EPOLL_CTL */ + +/* Define if your system supports the wepoll module */ +/* #undef EVENT__HAVE_WEPOLL */ + +/* Define to 1 if you have the `eventfd' function. */ +/* #undef EVENT__HAVE_EVENTFD */ + +/* Define if your system supports event ports */ +/* #undef EVENT__HAVE_EVENT_PORTS */ + +/* Define to 1 if you have the `fcntl' function. */ +#define EVENT__HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `getaddrinfo' function. */ +#define EVENT__HAVE_GETADDRINFO 1 + +/* Define to 1 if you have the `getegid' function. */ +#define EVENT__HAVE_GETEGID 1 + +/* Define to 1 if you have the `geteuid' function. */ +#define EVENT__HAVE_GETEUID 1 + +/* TODO: Check for different gethostname argument counts. CheckPrototypeDefinition.cmake can be used. */ +/* Define this if you have any gethostbyname_r() */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R */ + +/* Define this if gethostbyname_r takes 3 arguments */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R_3_ARG */ + +/* Define this if gethostbyname_r takes 5 arguments */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R_5_ARG */ + +/* Define this if gethostbyname_r takes 6 arguments */ +/* #undef EVENT__HAVE_GETHOSTBYNAME_R_6_ARG */ + +/* Define to 1 if you have the `getifaddrs' function. */ +#define EVENT__HAVE_GETIFADDRS 1 + +/* Define to 1 if you have the `getnameinfo' function. */ +#define EVENT__HAVE_GETNAMEINFO 1 + +/* Define to 1 if you have the `getprotobynumber' function. */ +#define EVENT__HAVE_GETPROTOBYNUMBER 1 + +/* Define to 1 if you have the `getservbyname' function. */ +#define EVENT__HAVE_GETSERVBYNAME 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#define EVENT__HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_IFADDRS_H 1 + +/* Define to 1 if you have the `inet_ntop' function. */ +#define EVENT__HAVE_INET_NTOP 1 + +/* Define to 1 if you have the `inet_pton' function. */ +#define EVENT__HAVE_INET_PTON 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `issetugid' function. */ +#define EVENT__HAVE_ISSETUGID 1 + +/* Define to 1 if you have the `kqueue' function. */ +#define EVENT__HAVE_KQUEUE 1 + +/* Define if the system has zlib */ +/* #undef EVENT__HAVE_LIBZ */ + +/* Define to 1 if you have the `mach_absolute_time' function. */ +#define EVENT__HAVE_MACH_ABSOLUTE_TIME 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_MACH_MACH_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_MACH_MACH_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mmap' function. */ +#define EVENT__HAVE_MMAP 1 + +/* Define to 1 if you have the `nanosleep' function. */ +#define EVENT__HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the `usleep' function. */ +#define EVENT__HAVE_USLEEP 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_NETINET_IN6_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_NETINET_TCP_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_AFUNIX_H */ + +/* Define if the system has openssl */ +/* #undef EVENT__HAVE_OPENSSL */ + +/* Define to 1 if you have the `pipe' function. */ +#define EVENT__HAVE_PIPE 1 + +/* Define to 1 if you have the `pipe2' function. */ +/* #undef EVENT__HAVE_PIPE2 */ + +/* Define to 1 if you have the `poll' function. */ +#define EVENT__HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_POLL_H 1 + +/* Define to 1 if you have the `port_create' function. */ +/* #undef EVENT__HAVE_PORT_CREATE */ + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_PORT_H */ + +/* Define if we have pthreads on this system */ +#define EVENT__HAVE_PTHREADS 1 + +/* Define to 1 if you have the `putenv' function. */ +#define EVENT__HAVE_PUTENV 1 + +/* Define to 1 if the system has the type `sa_family_t'. */ +#define EVENT__HAVE_SA_FAMILY_T 1 + +/* Define to 1 if you have the `select' function. */ +#define EVENT__HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +#define EVENT__HAVE_SETENV 1 + +/* Define if F_SETFD is defined in */ +#define EVENT__HAVE_SETFD 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#define EVENT__HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the `sendfile' function. */ +#define EVENT__HAVE_SENDFILE 1 + +/* Define to 1 if you have the `sigaction' function. */ +#define EVENT__HAVE_SIGACTION 1 + +/* Define to 1 if you have the `signal' function. */ +#define EVENT__HAVE_SIGNAL 1 + +/* Define to 1 if you have the `strsignal' function. */ +#define EVENT__HAVE_STRSIGNAL 1 + +/* Define to 1 if you have the `splice' function. */ +/* #undef EVENT__HAVE_SPLICE */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_STRING_H 1 + +/* Define to 1 if you have the `strlcpy' function. */ +#define EVENT__HAVE_STRLCPY 1 + +/* Define to 1 if you have the `strsep' function. */ +#define EVENT__HAVE_STRSEP 1 + +/* Define to 1 if you have the `strtok_r' function. */ +#define EVENT__HAVE_STRTOK_R 1 + +/* Define to 1 if you have the `strtoll' function. */ +#define EVENT__HAVE_STRTOLL 1 + +/* Define to 1 if you have the `_gmtime64_s' function. */ +/* #undef EVENT__HAVE__GMTIME64_S */ + +/* Define to 1 if you have the `_gmtime64' function. */ +/* #undef EVENT__HAVE__GMTIME64 */ + +/* Define to 1 if the system has the type `struct addrinfo'. */ +#define EVENT__HAVE_STRUCT_ADDRINFO 1 + +/* Define to 1 if the system has the type `struct in6_addr'. */ +#define EVENT__HAVE_STRUCT_IN6_ADDR 1 + +/* Define to 1 if `s6_addr16' is member of `struct in6_addr'. */ +/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR16 */ + +/* Define to 1 if `s6_addr32' is member of `struct in6_addr'. */ +/* #undef EVENT__HAVE_STRUCT_IN6_ADDR_S6_ADDR32 */ + +/* Define to 1 if the system has the type `struct sockaddr_in6'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_IN6 1 + +/* Define to 1 if `sin6_len' is member of `struct sockaddr_in6'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN 1 + +/* Define to 1 if `sin_len' is member of `struct sockaddr_in'. */ +/* #undef EVENT__HAVE_STRUCT_SOCKADDR_IN_SIN_LEN */ + +/* Define to 1 if the system has the type `struct sockaddr_un'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_UN 1 + +/* Define to 1 if the system has the type `struct sockaddr_storage'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE 1 + +/* Define to 1 if `ss_family' is a member of `struct sockaddr_storage'. */ +#define EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY 1 + +/* Define to 1 if `__ss_family' is a member of `struct sockaddr_storage'. */ +/* #undef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY */ + +/* Define to 1 if the system has the type `struct linger'. */ +#define EVENT__HAVE_STRUCT_LINGER 1 + +/* Define to 1 if you have the `sysctl' function. */ +#define EVENT__HAVE_SYSCTL 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_EPOLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_EVENTFD_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_EVENT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_QUEUE_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_SENDFILE_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_RANDOM_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_SYSCTL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef EVENT__HAVE_SYS_TIMERFD_H */ + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_ERRNO_H 1 + +/* Define if TAILQ_FOREACH is defined in */ +#define EVENT__HAVE_TAILQFOREACH 1 + +/* Define if timeradd is defined in */ +#define EVENT__HAVE_TIMERADD 1 + +/* Define if timerclear is defined in */ +#define EVENT__HAVE_TIMERCLEAR 1 + +/* Define if timercmp is defined in */ +#define EVENT__HAVE_TIMERCMP 1 + + +/* Define to 1 if you have the `timerfd_create' function. */ +/* #undef EVENT__HAVE_TIMERFD_CREATE */ + +/* Define if timerisset is defined in */ +#define EVENT__HAVE_TIMERISSET 1 + +/* Define to 1 if the system has the type `uint8_t'. */ +#define EVENT__HAVE_UINT8_T 1 + +/* Define to 1 if the system has the type `uint16_t'. */ +#define EVENT__HAVE_UINT16_T 1 + +/* Define to 1 if the system has the type `uint32_t'. */ +#define EVENT__HAVE_UINT32_T 1 + +/* Define to 1 if the system has the type `uint64_t'. */ +#define EVENT__HAVE_UINT64_T 1 + +/* Define to 1 if the system has the type `uintptr_t'. */ +#define EVENT__HAVE_UINTPTR_T 1 + +/* Define to 1 if you have the `umask' function. */ +#define EVENT__HAVE_UMASK 1 + +/* Define to 1 if you have the header file. */ +#define EVENT__HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#define EVENT__HAVE_UNSETENV 1 + +/* Define to 1 if you have the `vasprintf' function. */ +#define EVENT__HAVE_VASPRINTF 1 + +/* Define if kqueue works correctly with pipes */ +#define EVENT__HAVE_WORKING_KQUEUE 1 + +#ifdef __USE_UNUSED_DEFINITIONS__ +/* Define to necessary symbol if this constant uses a non-standard name on your system. */ +/* XXX: Hello, this isn't even used, nor is it defined anywhere... - Ellzey */ +#define EVENT__PTHREAD_CREATE_JOINABLE +#endif + +/* The size of `pthread_t', as computed by sizeof. */ +#define EVENT__SIZEOF_PTHREAD_T 8 + +/* The size of a `int', as computed by sizeof. */ +#define EVENT__SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define EVENT__SIZEOF_LONG 8 + +/* The size of a `long long', as computed by sizeof. */ +#define EVENT__SIZEOF_LONG_LONG 8 + +/* The size of `off_t', as computed by sizeof. */ +#define EVENT__SIZEOF_OFF_T 8 + +#define EVENT__SIZEOF_SSIZE_T 8 + + +/* The size of a `short', as computed by sizeof. */ +#define EVENT__SIZEOF_SHORT 2 + +/* The size of `size_t', as computed by sizeof. */ +#define EVENT__SIZEOF_SIZE_T 8 + +/* Define to 1 if you can safely include both and . */ +/* #undef EVENT__TIME_WITH_SYS_TIME */ + +/* The size of `socklen_t', as computed by sizeof. */ +#define EVENT__SIZEOF_SOCKLEN_T 4 + +/* The size of 'void *', as computer by sizeof */ +#define EVENT__SIZEOF_VOID_P 8 + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* why not c++? + * + * and are we really expected to use EVENT__inline everywhere, + * shouldn't we just do: + * ifdef EVENT__inline + * define inline EVENT__inline + * + * - Ellzey + */ + +#define EVENT__inline inline +#endif + +#define EVENT__HAVE___func__ 1 +#define EVENT__HAVE___FUNCTION__ 1 + +/* Define to `unsigned' if does not define. */ +#define EVENT__size_t size_t + +/* Define to unsigned int if you dont have it */ +#define EVENT__socklen_t socklen_t + +/* Define to `int' if does not define. */ +#define EVENT__ssize_t ssize_t + +#endif /* \EVENT2_EVENT_CONFIG_H_INCLUDED_ */ +END_OF_CONFIG + +Pod::Spec.new do |spec| + spec.name = "libevent" + spec.version = "2.1.12.1" + spec.summary = "Event notification library" + spec.description = "The libevent API provides a mechanism to execute a callback function when a specific event occurs on a file descriptor or after a timeout has been reached. Furthermore, libevent also support callbacks due to signals or regular timeouts." + spec.homepage = "https://libevent.org" + spec.license = { :type => "BSD 3-Clause", :file => "LICENSE" } + spec.author = "Niels Provos and Nick Mathewson" + spec.platforms = min_supported_versions + spec.source = { :git => "https://github.com/libevent/libevent.git", :tag => "release-2.1.12-stable" } + spec.prepare_command = "echo 'executing libevent prepare command'; touch evconfig-private.h; echo -e #{Shellwords.escape(CONFIG_WITHOUT_OPENSSL)} > include/event2/event-config.h; ls include/event2/" + spec.source_files = + "include/*.h", "*-{internal,private}.h", + "buffer.c", "bufferevent.c", "bufferevent_filter.c", "bufferevent_pair.c", "bufferevent_ratelim.c", "bufferevent_sock.c", + "event.c", "evmap.c", "evthread.c", "evutil.c", "evutil_rand.c", "evutil_time.c", + "kqueue.c", "listener.c", "log.c", "poll.c", "select.c", "signal.c", "strlcpy.c", "watch.c", + "evdns.c", "event_tagging.c", "evrpc.c", "http.c" + spec.private_header_files = "*-{internal,private}.h" + spec.public_header_files = "include/*.h" + spec.preserve_paths = "include/event2/*.h" + spec.xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/include/\"" } +end \ No newline at end of file diff --git a/packages/rn-tester/Podfile b/packages/rn-tester/Podfile index 36f670df0d5e8d..e0d55c1e0e5f7b 100644 --- a/packages/rn-tester/Podfile +++ b/packages/rn-tester/Podfile @@ -1,7 +1,7 @@ require_relative '../react-native/scripts/react_native_pods' source 'https://cdn.cocoapods.org/' -platform :ios, min_ios_version_supported +platform :visionos, min_visionos_version_supported cmake_path = `command -v cmake` @@ -41,7 +41,8 @@ def pods(target_name, options = {}, use_flipper: $shouldUseFlipper) # Hermes is now enabled by default. # The following line will only disable Hermes if the USE_HERMES envvar is SET to a value other than 1 (e.g. USE_HERMES=0). - hermes_enabled = !ENV.has_key?('USE_HERMES') || ENV['USE_HERMES'] == '1' + # TODO: Make hermes work + hermes_enabled = false # !ENV.has_key?('USE_HERMES') || ENV['USE_HERMES'] == '1' puts "Configuring #{target_name} with Fabric #{fabric_enabled ? "enabled" : "disabled"}.#{hermes_enabled ? " Using Hermes engine." : ""}" use_react_native!( @@ -77,7 +78,8 @@ end target 'RNTesterUnitTests' do pods('RNTesterUnitTests') pod 'React-RCTTest', :path => "./RCTTest" - pod 'OCMock', '~> 3.9.1' + # TODO: Uncomment this once OCMock is released https://cocoapods.org/pods/OCMock + # pod 'OCMock', '~> 3.9.2' end target 'RNTesterIntegrationTests' do diff --git a/packages/rn-tester/RNTester/AppDelegate.mm b/packages/rn-tester/RNTester/AppDelegate.mm index 7064ac1a18894a..292e997b8edd44 100644 --- a/packages/rn-tester/RNTester/AppDelegate.mm +++ b/packages/rn-tester/RNTester/AppDelegate.mm @@ -94,6 +94,7 @@ - (void)application:(__unused UIApplication *)application [RCTPushNotificationManager didFailToRegisterForRemoteNotificationsWithError:error]; } +#if !TARGET_OS_VISION // Required for the remoteNotificationReceived event. - (void)application:(__unused UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification { @@ -104,11 +105,17 @@ - (void)application:(__unused UIApplication *)application didReceiveRemoteNotifi - (void)application:(__unused UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification { - [RCTPushNotificationManager didReceiveLocalNotification:notification]; + [RCTPushNotificationManager didReceiveNotification:response.notification]; } - #endif +#pragma mark - New Arch Enabled settings + +- (BOOL)bridgelessEnabled +{ + return [super bridgelessEnabled]; +} + #pragma mark - RCTComponentViewFactoryComponentProvider #if RCT_NEW_ARCH_ENABLED