jodybrewster / react-native-linkedin-login

React Native Linkedin login
71 stars 42 forks source link

Import syntax has changed for your Objective C file #24

Closed dittmarconsulting closed 7 years ago

dittmarconsulting commented 7 years ago

Hi there,

I implemented your solution into a test project. Here my findings:

Android: The path described here is wrong. If the path is taken as is this error will appear Error:Project :app declares a dependency from configuration 'compile' to configuration 'default' which is not declared in the descriptor for project :react-native-linkedin-login.

The correct path should be:

//project(':react-native-linkedin-login').projectDir = new File(rootProject.projectDir, '../../android')
project(':react-native-linkedin-login').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-linkedin-login/android')

iOS: I added a console log in the file /android/react-native-linkedin-login/src/LinkedinLogin.js.

constructor() {
   console.log('RNLinkedinLogin', RNLinkedinLogin);
}

I always got an undefined for the RNLinkedinLogin object

Then I thought I might have to compile the LinkedinLogin.m explicitly. So I dropped it into the Build Phases -> Compiled Sources and tried to build the project, which gave me view errors.

After looking into the files I discovered that the import syntax is not correct for react native 0.40 and above.

I changed the import in file RNLinkedinLogin.m

// old syntax
//#import "RCTEventDispatcher.h"
// new syntax
#import <React/RCTEventDispatcher.h>

and the import in file 'RNLinkedinLogin.h`

//#import "RCTBridgeModule.h"
#import <React/RCTBridgeModule.h>

After that I got the project compiled and I got the correct object RNLinkedinLogin

Please update the files accordingly.

Thanks

jodybrewster commented 7 years ago

Ya I'm just getting around to updating to 0.40+ this weekend. Thanks for the tips! 🥇