Open onlybenyang opened 3 years ago
@Override public void onReq(BaseReq baseReq) { WritableMap map = Arguments.createMap(); map.putString("openId", baseReq.openId); map.putString("transaction", baseReq.transaction); if (baseReq.getType() == ConstantsAPI.COMMAND_SHOWMESSAGE_FROM_WX) { ShowMessageFromWX.Req req = (ShowMessageFromWX.Req) baseReq; // 对应JsApi navigateBackApplication中的extraData字段数据 map.putString("type", "SendMessageToWX.Resp"); map.putString("lang", req.lang); map.putString("country", req.message.messageExt); } this.getReactApplicationContext() .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("WeChat_Resp", map);
有误的地方: this.getReactApplicationContext() .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("WeChat_Resp", map); 中WeChat_Resp应该写成WeChat_Req
this.getReactApplicationContext() .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("WeChat_Resp", map);
改了也监听不了
这个只是把结果告诉前端,跟前端监听的名字一样就可以了吧。
有误的地方:
this.getReactApplicationContext() .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class) .emit("WeChat_Resp", map);
中WeChat_Resp应该写成WeChat_Req