1

The TypeScript definition file included with the React-Native SFMC SDK is incorrect.

The MCReactModule is exported as a normal export.

export class MCReactModule {
  static isPushEnabled(): Promise<boolean>;
  ...

But it should be a default export.

export default class MCReactModule {
  static isPushEnabled(): Promise<boolean>;
  ...
}

My temporary workaround is to add a sfmc.d.ts file to my project with:

declare module "react-native-marketingcloudsdk" {
  export default class MCReactModule {
    static isPushEnabled(): Promise<boolean>;
    static enablePush(): void;
    static disablePush(): void;
    static getSystemToken(): Promise<string>;
    static getAttributes(): Promise<Map<string, string>>;
    static setAttribute(key: string, value: string): void;
    static clearAttribute(key: string): void;
    static addTag(tag: string): void;
    static removeTag(tag: string): void;
    static getTags(): Promise<Array<string>>;
    static setContactKey(contactKey: string): void;
    static getContactKey(): Promise<string>;
    static enableVerboseLogging(): void;
    static disableVerboseLogging(): void;
    static logSdkState(): void;
  }
}
  • @BillMote This is off-topic?! Where am I supposed to report issues like this? The repo has no issues section, the iOS SDK is not the right place, SFMC support tells me to use this site. This is so frustrating. Also the new 7.x React-Native SFMC SDK won't build on iOS, where do I report that? – Zyphrax Apr 3 at 16:39
  • I didn't flag this as off-topic. Why are you at-mentioning me? – Bill Mote Apr 3 at 21:38
  • Also, I have personally built the example application on both Android and iOS without making any changes to the project. – Bill Mote Apr 3 at 21:44
  • @BillMote Because you are an engineer on the SDK and I'm just getting really frustrated about the lack of technical support for a commercial product. Did you use TypeScript, import the library and try to compile the script? – Zyphrax Apr 5 at 0:07
  • No, and we make no assertion that we'll work outside of the documentation found npmjs.com/package/react-native-marketingcloudsdk. The plugin is 100% compatible with React Native. If modifications are required to make the plugin work with TypeScript then that is up to the application developer to do. – Bill Mote Apr 5 at 4:30