In React Native 0.75, with New Architecture enabled, iOS builds fail with the following error:
ios/build/generated/ios/RNFileAccessSpec/RNFileAccessSpec.h:29:9:
fatal error: 'ReactCommon/RCTTurboModule.h' file not found
#import <ReactCommon/RCTTurboModule.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To reproduce
create a React Native 0.75 project with npx @react-native-community/cli init
install pods with New Architecture enabled: cd ios && bundle install && RCT_NEW_ARCH_ENABLED=1 pod install
build for iOS: npm run ios
Details
It looks like some React Native internals have changed in v0.75 and react-native-file-access is no longer pulling in the correct dependencies for Turbo Modules.
This PR fixes the issue by updating the podspec file to use install_modules_dependencies to install the extra dependencies required for the New Architecture instead of declaring dependencies explicitly.
Bug
In React Native 0.75, with New Architecture enabled, iOS builds fail with the following error:
To reproduce
npx @react-native-community/cli init
npm install react-native-file-access
cd ios && bundle install && RCT_NEW_ARCH_ENABLED=1 pod install
npm run ios
Details
It looks like some React Native internals have changed in v0.75 and
react-native-file-access
is no longer pulling in the correct dependencies for Turbo Modules.This PR fixes the issue by updating the podspec file to use
install_modules_dependencies
to install the extra dependencies required for the New Architecture instead of declaring dependencies explicitly.This is the recommended approach as per the React Native docs.
Testing
I've tested this against the following React Native versions to confirm that the fix is backwards compatible:
Thanks!