Skip to content

Commit c0be76e

Browse files
authored
Fix Number.h not copied from react-native core (#14331)
## Description ### Type of Change - Bug fix (non-breaking change which fixes an issue) ### Why react-native-windows currently maintains its own forked C++ TurboModule bridging files. For untouched stuff we copy JSI and TurboModule files from core react-native in `Layout-MSRN-Headers.ps1`. However, this script misses to copy `Number.h`. This causes compilation error when trying to import `react/bridging/Bridging.h`, which would be the case for example when using codegen to generate C++ TurboModule (JSI) bindings (note: this is for C++ JSI TurboModules, not react-native-windows's TurboModule system). ``` PS C:\Users\CocoT1\Projects\rn77> yarn example windows [...] Time Elapsed 00:00:00.61 ✔ Restoring NuGet packages ✔ Auto-linking... Success: No auto-linking changes necessary. (69ms) ✔ Found Solution: C:\Users\CocoT1\Projects\rn77\example\windows\rn77Example.sln ℹ Build configuration: Debug ℹ Build platform: x64 ✖ Building Solution: Generating Code... ✖ Build failed with message 4:7>C:\Users\CocoT1\.nuget\packages\microsoft.reactnative.cxx\0.77.0-fabric\tools\Microsoft.ReactNative.Cxx\ReactCommon\react\bridging\Bridging.h(18,10): error C1083: Cannot open include file: 'react/bridging/Number.h': No such file or directory [C:\Users\CocoT1\Projects\rn77\example\windows\rn77Example\rn77Example.vcxproj]. Check your build configuration. ``` ### What I'm changing the `Layout-MSRN-Headers.ps1` script to also copy `Number.h`. I think this should be enough for the nuget the contain to file, but I'm no expert here. ## Testing Monkeypatched by copying over Number.h to the microsoft.reactnative.cxx nuget (`C:\Users\CocoT1\.nuget\packages\microsoft.reactnative.cxx\0.77.0-fabric\tools\Microsoft.ReactNative.Cxx\ReactCommon\react\bridging\`). Works all good. I don't know how to run the `Layout-MSRN-Headers.ps1` script locally. Here's a create-react-native-library project: https://github.com/hsjoberg/rnw-cxx-turbomodule Note: it will fail to build unless you copy Number.h over to the nuget cache as explained earlier.
1 parent 990994b commit c0be76e

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Fix Number.h not copied from react-native core",
4+
"packageName": "react-native-windows",
5+
"email": "hampus.sjoberg@protonmail.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Scripts/Tfs/Layout-MSRN-Headers.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Convert.h -De
108108
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Error.h -Destination $MSRNCxxTargetRoot\ReactCommon\react\bridging\
109109
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\EventEmitter.h -Destination $MSRNCxxTargetRoot\ReactCommon\react\bridging\
110110
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Function.h -Destination $MSRNCxxTargetRoot\ReactCommon\react\bridging\
111+
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Number.h -Destination $MSRNCxxTargetRoot\ReactCommon\react\bridging\
111112
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\LongLivedObject.cpp -Destination $MSRNCxxTargetRoot\ReactCommon\react\bridging\
112113
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\LongLivedObject.h -Destination $MSRNCxxTargetRoot\ReactCommon\react\bridging\
113114
Copy-Item -Force -Path $ReactNativeRoot\ReactCommon\react\bridging\Object.h -Destination $MSRNCxxTargetRoot\ReactCommon\react\bridging\

0 commit comments

Comments
 (0)