alpha0010 / react-native-file-access

Filesystem access for React Native
MIT License
313 stars 26 forks source link

fix(ios): use `install_modules_dependencies` in podspec file #88

Closed yousif-bugsnag closed 2 months ago

yousif-bugsnag commented 3 months ago

Bug

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

  1. create a React Native 0.75 project with npx @react-native-community/cli init
  2. install react-native-file-access: npm install react-native-file-access
  3. install pods with New Architecture enabled: cd ios && bundle install && RCT_NEW_ARCH_ENABLED=1 pod install
  4. 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.

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!

alpha0010 commented 2 months ago

Thanks, live in: v3.1.1