After upgrading to React Native 0.78 and enabling the New Architecture, my iOS build fails in Xcode with the following error:
This occurs when trying to build my app with react-native-worklets-core (used by VisionCamera for Frame Processors).
"react-native": "0.78.0",
"react-native-worklets-core": "1.5.0",
"react-native-vision-camera": "4.6.3",
"react": "19.0.0",
yarn react-native codegen
Actually, this file should be automatically generated by React Native's Codegen system when New Architecture (RCT_NEW_ARCH_ENABLED=1) is enabled when the RNWorkletsSpec.h
file is part of the TurboModule interface for the react-native-worklets-core
library. If it's missing, it likely means the file hasn't been built or maybe the Xcode cannot find it.
So add the following configuration to your package.json
:
"codegenConfig": {
"name": "Worklets",
"type": "modules",
"jsSrcsDir": "src",
"android": {
"cmake": false
}
}
Now clean and rebuild the Codegen, so run the lines one after the other:
watchman watch-del-all
rm -rf node_modules ios/Pods ios/build
yarn install
cd ios
RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
cd ..
yarn react-native codegen
After the above release you should find the header RNWorkletsSpec.h
file in the following path:
ios/build/generated/