diff --git a/packages/out-of-tree-platforms/.gitignore b/packages/out-of-tree-platforms/.gitignore deleted file mode 100644 index ac0720f94136cd..00000000000000 --- a/packages/out-of-tree-platforms/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Build output -/dist \ No newline at end of file diff --git a/packages/out-of-tree-platforms/README.md b/packages/out-of-tree-platforms/README.md deleted file mode 100644 index 972663edaca00e..00000000000000 --- a/packages/out-of-tree-platforms/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# @callstack/out-of-tree-platforms - -[![Version][version-badge]][package] - -Utilities for Out of Tree (OOT) platforms. - -## `getPlatformResolver` - -```js -getPlatformResolver(options: ResolverConfig): CustomResolver -``` - -### options - -```js -type ResolverConfig = { - platformImplementations: {[platform: string]: string}, -}; -``` diff --git a/packages/out-of-tree-platforms/index.js.flow b/packages/out-of-tree-platforms/index.js.flow deleted file mode 100644 index 8420b1093fdb2f..00000000000000 --- a/packages/out-of-tree-platforms/index.js.flow +++ /dev/null @@ -1 +0,0 @@ -export * from './src'; diff --git a/packages/out-of-tree-platforms/package.json b/packages/out-of-tree-platforms/package.json deleted file mode 100644 index 50d06c80d19a54..00000000000000 --- a/packages/out-of-tree-platforms/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@callstack/out-of-tree-platforms", - "version": "0.77.0-main", - "description": "Utils for React Native out of tree platforms.", - "keywords": ["out-of-tree", "react-native"], - "homepage": "https://github.com/callstack/react-native-visionos/tree/HEAD/packages/out-of-tree-platforms#readme", - "bugs": "https://github.com/callstack/react-native-visionos/issues", - "repository": { - "type": "git", - "url": "https://github.com/callstack/react-native-visionos.git", - "directory": "packages/out-of-tree-platforms" - }, - "license": "MIT", - "exports": { - ".": "./src/index.js", - "./package.json": "./package.json" - }, - "files": [ - "dist" - ], - "devDependencies": { - "metro-resolver": "^0.81.0" - }, - "engines": { - "node": ">=18" - } -} diff --git a/packages/out-of-tree-platforms/src/getPlatformResolver.js b/packages/out-of-tree-platforms/src/getPlatformResolver.js deleted file mode 100644 index 70e3acde5c1d78..00000000000000 --- a/packages/out-of-tree-platforms/src/getPlatformResolver.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * 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. - * - * @flow - * @format - */ - -import type {CustomResolver} from 'metro-resolver'; - -type ResolverConfig = { - platformNameMap: {[platform: string]: string}, -}; - -/** - * Creates a custom Metro resolver that maps platform extensions to package names. - * To be used in app's `metro.config.js` as `resolver.resolveRequest`. - */ -export const getPlatformResolver = (config: ResolverConfig): CustomResolver => { - return (context, moduleName, platform) => { - // `customResolverOptions` is populated through `?resolver.platformExtension` query params - // in the jsBundleURLForBundleRoot method of the react-native/React/Base/RCTBundleURLProvider.mm - const platformExtension = context.customResolverOptions?.platformExtension; - let modifiedModuleName = moduleName; - if ( - typeof platformExtension === 'string' && - config.platformNameMap?.[platformExtension] - ) { - const packageName = config.platformNameMap[platformExtension]; - if (moduleName === 'react-native') { - modifiedModuleName = packageName; - } else if (moduleName.startsWith('react-native/')) { - modifiedModuleName = `${packageName}/${modifiedModuleName.slice( - 'react-native/'.length, - )}`; - } - } - - return context.resolveRequest(context, modifiedModuleName, platform); - }; -}; diff --git a/packages/out-of-tree-platforms/src/index.flow.js b/packages/out-of-tree-platforms/src/index.flow.js deleted file mode 100644 index 2244b1ce77d29e..00000000000000 --- a/packages/out-of-tree-platforms/src/index.flow.js +++ /dev/null @@ -1,5 +0,0 @@ -if (!process.env.BUILD_EXCLUDE_BABEL_REGISTER) { - require('../../../scripts/build/babel-register').registerForMonorepo(); -} - -export * from './getPlatformResolver'; diff --git a/packages/out-of-tree-platforms/src/index.js b/packages/out-of-tree-platforms/src/index.js deleted file mode 100644 index 2244b1ce77d29e..00000000000000 --- a/packages/out-of-tree-platforms/src/index.js +++ /dev/null @@ -1,5 +0,0 @@ -if (!process.env.BUILD_EXCLUDE_BABEL_REGISTER) { - require('../../../scripts/build/babel-register').registerForMonorepo(); -} - -export * from './getPlatformResolver'; diff --git a/packages/react-native/README.md b/packages/react-native/README.md index 83322bfa66ae0d..d1c7aba05cae5f 100644 --- a/packages/react-native/README.md +++ b/packages/react-native/README.md @@ -1,8 +1,52 @@ -# Where is the template? -The React Native Template has moved from being shipping inside the [react-native](https://www.npmjs.com/package/react-native) package to it's own package: [@react-native-community/template](https://github.com/react-native-community/template). +

+ + React Native visionOS + +

-## Why has it moved? -The [React Native Frameworks RFC0759](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0759-react-native-frameworks.md#evolving-the-react-native-community-template--cli) provides background information. +

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

-## When was it moved? -The 0.75 release. +React Native visionOS 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. + +![Screenshot](https://github.com/callstack/react-native-visionos/assets/52801365/0fcd5e5f-628c-49ef-84ab-d1d4675a011a) + +## 🎉 Building your first spatial React Native app +Follow the [Getting Started](https://callstack.github.io/react-native-visionos-docs/category/getting-started) guide. If you wish to get started quickly, you can utilize this command: + +```sh +npx @callstack/react-native-visionos@latest init YourApp +``` + + +## 📖 Documentation + +The full documentation for React Native visionOS can be found on our [website](https://callstack.github.io/react-native-visionos-docs). + +The source for the React Native visionOS documentation and website is hosted on a separate repo, @callstack/react-native-visionos-docs. + +## Contributing + +Prerequisites: +- Download the latest Xcode (at least 15.2) +- Install the latest version of CMake (at least v3.29.0) + +Check out `rn-tester` [README.md](./packages/rn-tester/README.md) to build React Native from the source. + +Remember to use `RNTester-visionOS` target + +If `RNTester-visionOS` scheme is not showing up, click "New Scheme", which should be pre-populated with `RNTester-visionOS`. Build the app using Xcode. + +## Release process + +We use a script called `oot-release.js` which automatically releases `visionos` packages and aligns versions of dependencies with React Native core. + +Usage: + +```sh +node ./scripts/oot-release.js --new-version "" --react-native-version "" --one-time-password "" +``` + +To test releases and template we use [Verdaccio](https://verdaccio.org/). diff --git a/packages/react-native/package.json b/packages/react-native/package.json index cc42e6e873d7a7..a6469aa055fc35 100644 --- a/packages/react-native/package.json +++ b/packages/react-native/package.json @@ -171,4 +171,4 @@ } ] } -} +} \ No newline at end of file diff --git a/packages/rn-tester/package.json b/packages/rn-tester/package.json index 32769b5355747c..5ab72cbcaa73e2 100644 --- a/packages/rn-tester/package.json +++ b/packages/rn-tester/package.json @@ -31,8 +31,7 @@ "@react-native/popup-menu-android": "0.77.0-main", "flow-enums-runtime": "^0.0.6", "invariant": "^2.2.4", - "nullthrows": "^1.1.1", - "@callstack/out-of-tree-platforms": "0.77.0-main" + "nullthrows": "^1.1.1" }, "peerDependencies": { "react": "19.0.0", diff --git a/scripts/build/config.js b/scripts/build/config.js index bd1926e5d756e5..e889eb4d1b7986 100644 --- a/scripts/build/config.js +++ b/scripts/build/config.js @@ -58,10 +58,6 @@ const buildConfig /*: BuildConfig */ = { emitTypeScriptDefs: true, target: 'node', }, - 'out-of-tree-platforms': { - emitTypeScriptDefs: true, - target: 'node', - }, }, };