在 native react 中,我尝试使用“ddp-client”节点库连接到 meteor 服务器。连接成功后,我在客户端收到以下错误:
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)
最佳答案
process.nextTick
React Native 上不存在,所以我们必须对它进行 polyfill。就像 process.nextTick = setImmediate
一样简单.
示例:https://github.com/spencercarli/meteor-todos-react-native/blob/master/ReactNativeTodos/app/config/db/lib/process.polyfill.js
您需要确保在根组件文件(例如 index.ios.js)中执行此操作
希望这对你有帮助!
关于meteor - process.nextTick 不是一个函数(React native、ddp、meteor),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34845760/