Getting "Native module cannot be null"
shercoder opened this issue · comments
I have tried following your documents both (automatic and manual) but keep on getting this error:
/**
* @providesModule Apptentive
*/
import { Apptentive as RNApptentive, ApptentiveConfiguration } from 'apptentive-react-native';
import environment from '../environment';
class Apptentive {
constructor() {
const configuration = new ApptentiveConfiguration(
environment.apptentive.appKey,
environment.apptentive.appSig
);
// configuration.appleID = environment.apptentive.appleID;
RNApptentive.register(configuration);
}
/**
* Send device data to apptentive
* @param key Data key
* @param value Value
* @return Promise returning true or error
*/
addDeviceData = (key = '', value = '') => {
return RNApptentive.addCustomDeviceData(key, value);
};
/**
* Send person data to apptentive
* @param key Data key
* @param value Value
* @return Promise returning true or error
*/
addPersonData = (key = '', value = '') => {
return RNApptentive.addCustomPersonData(key, value);
};
/**
* Log an event to apptentive
* @param event String event name
* @return Promise with success boolean or error
*/
engageEvent = (event = '') => {
return RNApptentive.engage(event);
};
}
module.exports = new Apptentive();
NOTE: We are replacing the react-native-apptentive-module
with apptentive-react-native
Any help would be appreciated.
Hey @shercoder,
Can you provide the contents of your package.json
file?
"dependencies": {
...
"apptentive-react-native": "5.3.1",
...
},
Assuming you just want to see which version of apptentive I'm using?
ha I think I figured out the issue. So we have 2 targets in ios project: One for the device and one for a simulator. I was testing on simulator and react-native link
only linked the lib to device target (smh). So i had to manually link the lib to the simulator target as well.
closing. And thank you for such quick response. :)