无法访问本机模块(未定义不是对象)

时间:2016-11-21 15:22:53

标签: plugins react-native undefined

native-country-picker当我运行它时出现错误:

  

undefined不是对象NativeModules.CountryPicker.show

我尝试过这些步骤:

  • react-native upgrade
  • rnpm link (插件安装后) 和同样的错误。

这是国家选择器插件 https://github.com/tofugear/react-native-country-picker

这是插件的代码:

'use strict';

import { NativeModules } from 'react-native';

var RNCountryPicker= NativeModules.CountryPicker;
var CountryPicker = {};

CountryPicker.show = function (callBack) {
  NativeModules.CountryPicker.show(callBack);
};

CountryPicker.hide = function () {
  RNCountryPicker.hide();
};

module.exports = CountryPicker;

行中的错误:

  

NativeModules.CountryPicker.show(回调);

     

undefined不是对象(评估' _reactNative.NativeModules.CountryPicker.show')

0 个答案:

没有答案