process.nextTick不是函数(React native,ddp,meteor)

时间:2016-01-18 01:00:46

标签: meteor react-native ddp

对原生作出反应,我正在尝试使用' ddp-client'节点库连接到流星服务器。在连接成功后,我在客户端获得以下错误:

2016-01-17 16:14:15.992 [trace][tid:com.facebook.React.JavaScript] ddp message: {"msg":"connected","session":"PGLBqgvoeuXgBtke2"}
2016-01-17 16:14:16.007 [warn][tid:com.facebook.React.JavaScript] process.nextTick is not a function. (In 'process.nextTick(function(_this){
return function(){
return _this._flush();};}(

this))', 'process.nextTick' is undefined)
2016-01-17 16:14:16.008 [error][tid:com.facebook.React.RCTExceptionsManagerQueue] Unhandled JS Exception: process.nextTick is not a function. (In 'process.nextTick(function(_this){
return function(){
return _this._flush();};}(

this))', 'process.nextTick' is undefined)

3 个答案:

答案 0 :(得分:6)

process.nextTick在React Native上不存在,因此我们必须对其进行填充。这就像process.nextTick = setImmediate一样简单。

示例:https://github.com/spencercarli/meteor-todos-react-native/blob/master/ReactNativeTodos/app/config/db/lib/process.polyfill.js

您希望确保在根组件文件中执行此操作(例如index.ios.js)

希望这能帮到你!

答案 1 :(得分:0)

您还可以使用react-native-meteor包进行React Native Meteor集成。 https://www.npmjs.com/package/react-native-meteor请查看此链接以获取文档。

答案 2 :(得分:0)

我遇到了相同的问题,但是@Spencer Carli的答案并不完美,在调试模式下,不仅不需要进行Shiming nextTick(调试时js在v8中运行),还会使您的应用无法连接开发服务器(我不知道为什么,但实际上是这样)。因此,更合适的答案是:

languageCode