React-native-wechat: cannot read property ‘registerApp’ of undefined

Created on 24 Sep 2016  ·  13Comments  ·  Source: yorkie/react-native-wechat

我有一个Android工程,嵌入了react native代码,然后整合微信接入,按照文档的步骤,一步一步弄下来,在setting.gradle文件配置稍有不同,把原来的rootProject.projectDir 修改为了settingsDir。如下:
include ':RCTWeChat'
project(':RCTWeChat').projectDir = new File(settingsDir, './node_modules/react-native-wechat/android')

然后在JS文件中测试代码,报错:
cannot read property ‘registerApp’ of undefined

后面经过测试,发现只要加入下面的引用wechat语句,就会报这个错误:
var WeChat=require('react-native-wechat');

All 13 comments

  • 1。不过我的是IOS,完全按照文档来的,也是这个错误。

最新版本不会存在这个问题,亲测有效~

我也是这个问题,只要引入import * as WeChat from 'react-native-wechat';
就会报错:

undefined is not an object (evaluating 'WeChat.registerApp')

我的package.json配置:

"react-native-wechat": "^1.9.0",
"react": "15.3.2",
"react-native": "^0.36.0"

报错平台: ios

我也是报错, 按官方手动 readme做了还需要 react-native link 吗?

重新使用 react-packager 构建代码

和luojinghui 的问题一样,只是Android平台,
"react": "16.0.0-alpha.12",
"react-native": "0.47.2",
"react-native-wechat": "^1.9.9",

“undefined is not an object (evaluating 'WeChat.registerApp')”
只要引入 import * as WeChat from 'react-native-wechat';就报错

"react": "16.0.0-alpha.12",
"react-native": "0.46.4",
"react-native-wechat": "^1.9.9",

“undefined is not an object (evaluating 'WeChat.registerApp')”

iOS

最后是怎么解决的?我也遇到了这个问题

这个issue为啥被close了,怎么解决的?其他类似的issue也都没找到android下修复这个问题的办法。。清一色ios。。无语凝噎

怎么解决的啊

@4js @GodayMax 我记得上次解决是很仔细仔细仔细的重新配置了一边,就好了,没有特殊的处理。

you should addPackage() in the Antivity which The entrance of the RN @hanwufeidadi

咋解决的,被这个问题搞了好几个小时了

Was this page helpful?
0 / 5 - 0 ratings