问题描述
我正在尝试将 appsflyer 添加到我的 React Native 项目中。当我在真实设备上运行该应用程序时出现错误
undefined 不是一个对象(评估 's.initSdkWithCallBack')
当我检查 /react-native-appsflyer/index.js 文件时,我看到 react-native 库被导入
import {NativeEventEmitter,NativeModules} from "react-native";
const {RNAppsFlyer} = NativeModules;
const appsFlyer = {};
const eventsMap = {};
const appsFlyerEventEmitter = new NativeEventEmitter(RNAppsFlyer);
function initSdkCallback(options,successC,errorC) {
if (typeof options.appId !== 'string') {
return errorC('appId should be a string!');
}
if (typeof options.isDebug !== 'boolean') {
return errorC('isDebug should be a boolean!');
}
return RNAppsFlyer.initSdkWithCallBack(options,errorC);
}
所以当我看到 react-native 的路径时,路径是
"C:/Users/Alsong/AppData/Local/Microsoft/TypeScript/4.2/node_modules/@types/react-native/index"
而不是 node_modules 文件夹。
如何使导入来自 react-native 文件夹,该文件夹中包含一个包含“initSdkWithCallBack”方法的文件。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)