OpenNative / open-native

Open Native brings cross-platform communities together to help them collaborate and strengthen each other through development diversity.
https://open-native.org/
MIT License
454 stars 8 forks source link

react_native_rsa_native/RNRSA.h' file not found #8

Closed bretep closed 1 year ago

bretep commented 1 year ago

Library

npm install --save @open-native/core react-native-rsa-native

Error

In file included from /Volumes/Development/Work/.../node_modules/@open-native/core/platforms/ios/lib_community/RNPodspecs.m:1:
/Volumes/Development/Work/.../node_modules/@open-native/core/platforms/ios/lib_community/RNPodspecs.h:4:9: fatal error: 
      'react_native_rsa_native/RNRSA.h' file not found
#import <react_native_rsa_native/RNRSA.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Volumes/Development/Work/.../node_modules/@open-native/core/platforms/ios/lib_community/RNPodspecs.h:4:9: note: did not find header 'RNRSA.h' in
      framework 'react_native_rsa_native' (loaded from '/Volumes/Development/Work/.../platforms/ios/build/Debug-iphonesimulator/react-native-rsa-native')
1 error generated.
bretep commented 1 year ago

Same error after completing the following steps.

Version:

image

Ran:

npm install -D metro-react-native-babel-preset

Added to webpack:

...
    config.resolve.alias.set('react-native', '@open-native/core');
    config.module
      .rule('rnmodules')
      // Add each react-native module that gives errors in webpack build here
      // like this:
      .include.add(/node_modules(.*[/\\])+react-native-rsa-native/)
      .end()
      .use('babel-loader')
      .before('ts-loader')
      .loader('babel-loader')
      .options({
        babelrc: false,
        presets: ['module:metro-react-native-babel-preset'],
      });
...
ammarahm-ed commented 1 year ago

Hey @bretep Try doing the following to see if it fixes the issue:

  1. Create a RNRSA.h file in node_modules/react-native-rsa-native/ios/.
  2. Add the following contents to the file:
#import <React/RCTBridgeModule.h>

@interface RNRSA : NSObject <RCTBridgeModule>

@end
  1. Run the app with ns run ios.

  2. Post here the contents of RNPodspecs.h

ammarahm-ed commented 1 year ago

Swift modules now work with open-native!

bretep commented 1 year ago

Now I'm getting

Undefined symbols for architecture x86_64:
  "_RCTRegisterModule", referenced from:
      _initialize_RNRSA in RNRSA-eb438ca2a311d56d55e8cd4fc3e062f5.o
      _initialize_RNRSAKeychain in RNRSAKeychain-d66bd83edb08798d1ece26e10d112b88.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I don't know if this is related or because I'm running M1 and something else is up. :)