Skip to content

Commit 868500e

Browse files
committed
feat: add patch package
1 parent 54ec59a commit 868500e

File tree

7 files changed

+65
-5
lines changed

7 files changed

+65
-5
lines changed

packages/react-native/Libraries/NewAppScreen/components/Header.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const Header = (): Node => {
4242
]}>
4343
Welcome to
4444
{'\n'}
45-
React Native
45+
React Native visionOS
4646
</Text>
4747
</ImageBackground>
4848
);
@@ -65,7 +65,6 @@ const styles = StyleSheet.create({
6565
* source image's size.
6666
*/
6767
marginLeft: -128,
68-
marginBottom: -192,
6968
},
7069
text: {
7170
fontSize: 40,

packages/react-native/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<h1 align="center">
2+
<a href="https://reactnative.dev/">
3+
React Native Vision OS
4+
</a>
5+
</h1>
6+
7+
<p align="center">
8+
<strong>Learn once, write anywhere:</strong><br>
9+
Build spatial apps with React.
10+
</p>
11+
12+
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.
13+
14+
This project is still at an early stage of development and is not ready for production use.
15+
16+
## Contributing
17+
18+
1. Download latest Xcode beta [here](https://developer.apple.com/xcode/).
19+
2. Install visionOS Simulator runtime.
20+
3. (Optional) Using Hermes - Install latest version of CMake (3.28) from `main` branch:
21+
```sh
22+
brew install cmake --HEAD
23+
```
24+
4. Follow the same steps as for running iOS defined in [packages/rn-tester/README.md](./packages/rn-tester/README.md)

packages/react-native/React/Base/RCTBundleURLProvider.mm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ + (NSURL *)jsBundleURLForBundleRoot:(NSString *)bundleRoot
310310
[[NSURLQueryItem alloc] initWithName:@"platform" value:RCTPlatformName],
311311
[[NSURLQueryItem alloc] initWithName:@"dev" value:enableDev ? @"true" : @"false"],
312312
[[NSURLQueryItem alloc] initWithName:@"lazy" value:lazy ? @"true" : @"false"],
313+
[[NSURLQueryItem alloc] initWithName:@"resolver.variant" value:@"visionos"],
313314
[[NSURLQueryItem alloc] initWithName:@"minify" value:enableMinification ? @"true" : @"false"],
314315
[[NSURLQueryItem alloc] initWithName:@"inlineSourceMap" value:inlineSourceMap ? @"true" : @"false"],
315316
[[NSURLQueryItem alloc] initWithName:@"modulesOnly" value:modulesOnly ? @"true" : @"false"],

packages/react-native/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@callstack/react-native-visionos",
3-
"version": "1000.0.0",
3+
"version": "0.74.0-nightly-20231127",
44
"description": "React Native for visionOS",
55
"license": "MIT",
66
"repository": {

packages/react-native/template/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
"ios": "react-native run-ios",
88
"lint": "eslint .",
99
"start": "react-native start",
10-
"test": "jest"
10+
"test": "jest",
11+
"postinstall": "patch-package"
1112
},
1213
"dependencies": {
1314
"react": "18.2.0",
14-
"@callstack/react-native-visionos": "1000.0.0"
15+
"react-native": "0.74.0-nightly-20231123-342041e9e",
16+
"@callstack/react-native-visionos": "0.74.0-nightly-20231127"
1517
},
1618
"devDependencies": {
1719
"@babel/core": "^7.20.0",
@@ -26,6 +28,8 @@
2628
"babel-jest": "^29.6.3",
2729
"eslint": "^8.19.0",
2830
"jest": "^29.6.3",
31+
"patch-package": "^8.0.0",
32+
"postinstall-postinstall": "^2.1.0",
2933
"prettier": "2.8.8",
3034
"react-test-renderer": "18.2.0",
3135
"typescript": "5.0.4"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/node_modules/@react-native/community-cli-plugin/dist/utils/metroPlatformResolver.js b/node_modules/@react-native/community-cli-plugin/dist/utils/metroPlatformResolver.js
2+
index 5cd205a..fa8a320 100644
3+
--- a/node_modules/@react-native/community-cli-plugin/dist/utils/metroPlatformResolver.js
4+
+++ b/node_modules/@react-native/community-cli-plugin/dist/utils/metroPlatformResolver.js
5+
@@ -31,13 +31,14 @@ exports.reactNativePlatformResolver = reactNativePlatformResolver;
6+
*/
7+
function reactNativePlatformResolver(platformImplementations) {
8+
return (context, moduleName, platform) => {
9+
+ let platformOrVariant = context.customResolverOptions.variant || platform;
10+
let modifiedModuleName = moduleName;
11+
- if (platform != null && platformImplementations[platform]) {
12+
+ if (platformOrVariant != null && platformImplementations[platformOrVariant]) {
13+
if (moduleName === "react-native") {
14+
- modifiedModuleName = platformImplementations[platform];
15+
+ modifiedModuleName = platformImplementations[platformOrVariant];
16+
} else if (moduleName.startsWith("react-native/")) {
17+
modifiedModuleName = `${
18+
- platformImplementations[platform]
19+
+ platformImplementations[platformOrVariant]
20+
}/${modifiedModuleName.slice("react-native/".length)}`;
21+
}
22+
}

packages/react-native/template/visionos/HelloWorld.xcodeproj/project.pbxproj

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,13 @@
480480
);
481481
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
482482
PRODUCT_NAME = HelloWorld;
483+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
484+
SUPPORTS_MACCATALYST = NO;
485+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
486+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
483487
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
484488
SWIFT_VERSION = 5.0;
489+
TARGETED_DEVICE_FAMILY = "1,7";
485490
VERSIONING_SYSTEM = "apple-generic";
486491
};
487492
name = Debug;
@@ -506,7 +511,12 @@
506511
);
507512
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
508513
PRODUCT_NAME = HelloWorld;
514+
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator xros xrsimulator";
515+
SUPPORTS_MACCATALYST = NO;
516+
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
517+
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
509518
SWIFT_VERSION = 5.0;
519+
TARGETED_DEVICE_FAMILY = "1,7";
510520
VERSIONING_SYSTEM = "apple-generic";
511521
};
512522
name = Release;

0 commit comments

Comments
 (0)