diff --git a/NuGet.config b/NuGet.config new file mode 100644 index 00000000..e779dca0 --- /dev/null +++ b/NuGet.config @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/example/NuGet.config b/example/NuGet.config new file mode 100644 index 00000000..3a09aa94 --- /dev/null +++ b/example/NuGet.config @@ -0,0 +1,6 @@ + + + + diff --git a/example/android/gradle.properties b/example/android/gradle.properties index e67eac0b..4cfe3562 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -37,6 +37,7 @@ newArchEnabled=true # Use this property to enable or disable the Hermes JS engine. # If set to false, you will be using JSC instead. hermesEnabled=true +hermesV1Enabled=true # Use this property to enable edge-to-edge display support. # This allows your app to draw behind system bars for an immersive UI. diff --git a/example/metro.config.js b/example/metro.config.js index aa9a3813..428a6f9d 100644 --- a/example/metro.config.js +++ b/example/metro.config.js @@ -1,6 +1,13 @@ const path = require('path'); -const { getDefaultConfig } = require('@react-native/metro-config'); -const { withMetroConfig } = require('react-native-monorepo-config'); +const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config'); +const {withMetroConfig} = require('react-native-monorepo-config'); + +const fs = require('fs'); + +const rnwPath = fs.realpathSync( + path.resolve(require.resolve('react-native-windows/package.json'), '..'), +); +const normalizedRnwPath = rnwPath.replace(/[/\\]/g, '/'); const root = path.resolve(__dirname, '..'); @@ -10,9 +17,31 @@ const root = path.resolve(__dirname, '..'); * * @type {import('metro-config').MetroConfig} */ + const config = withMetroConfig(getDefaultConfig(__dirname), { root, dirname: __dirname, }); -module.exports = config; +module.exports = mergeConfig(config, { + resolver: { + blockList: [ + // This stops "npx @react-native-community/cli run-windows" from causing the metro server to crash if its already running + new RegExp( + `${path.resolve(__dirname, 'windows').replace(/[/\\]/g, '/')}.*`, + ), + // This prevents "npx @react-native-community/cli run-windows" from hitting: EBUSY: resource busy or locked, open msbuild.ProjectImports.zip or other files produced by msbuild + new RegExp(`${normalizedRnwPath}/build/.*`), + new RegExp(`${normalizedRnwPath}/target/.*`), + /.*\.ProjectImports\.zip/, + ], + }, + transformer: { + getTransformOptions: async () => ({ + transform: { + experimentalImportSupport: false, + inlineRequires: true, + }, + }), + }, +}); diff --git a/example/package.json b/example/package.json index 4cc24800..85870fa3 100644 --- a/example/package.json +++ b/example/package.json @@ -7,6 +7,7 @@ "android:prod": "react-native run-android --mode release", "ios": "react-native run-ios", "start": "react-native start", + "windows": "react-native run-windows", "windows:autolink": "./node_modules/.bin/rnc-cli autolink-windows --sln \"windows\\ReactNativeFsExample.sln\" --proj \"windows\\ReactNativeFsExample\\ReactNativeFsExample.vcxproj\"", "build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", "build:ios": "react-native build-ios --mode Debug" @@ -16,7 +17,8 @@ "lodash": "^4.17.23", "react": "19.2.3", "react-native": "0.84.0", - "react-native-safe-area-context": "^5.6.2" + "react-native-safe-area-context": "^5.6.2", + "react-native-windows": "0.82.0" }, "devDependencies": { "@babel/core": "^7.29.0", @@ -40,7 +42,7 @@ "init-windows": { "name": "ReactNativeFsExample", "namespace": "ReactNativeFsExample", - "template": "old/uwp-cpp-app" + "template": "cpp-app" } } } diff --git a/example/react-native.config.js b/example/react-native.config.js index 59d96982..b621b09e 100644 --- a/example/react-native.config.js +++ b/example/react-native.config.js @@ -15,6 +15,12 @@ module.exports = { // So we explicitly specify the platforms with empty object ios: {}, android: {}, + windows: {}, + }, + }, + '@dr.pogodin/react-native-static-server': { + platforms: { + windows: null, }, }, }, diff --git a/example/src/App.tsx b/example/src/App.tsx index 7d812d21..4c624f31 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -38,6 +38,7 @@ const AppContent: FunctionComponent = () => { {/* This does not quite fit into the test app style, but I don't have time now to style the new test section well. */}