我如何使用googleapis进行原生反应?

时间:2017-06-02 11:15:59

标签: node.js react-native google-api google-drive-api

目前,我正在尝试使用google drive API v3进行原生反应。我以google drive API v3 Node.js为例。但问题是,当我尝试将googleapis导入我的项目时,它显示如下错误。

enter image description here

我用谷歌搜索多次但无法找到解决方案。有人可以帮我解决这个问题吗?

1 个答案:

答案 0 :(得分:4)

Google Drive的Node.JS API使用了Node的内置private final AtomicBoolean scheduled = new AtomicBoolean(false); private final BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<Runnable>(maximumQueueSize); public void execute(Runnable command) { long timeout = 0; TimeUnit timeUnit = TimeUnit.SECONDS; if (command instanceof TimeoutRunnable) { TimeoutRunnable timeoutRunnable = ((TimeoutRunnable) command); timeout = timeoutRunnable.getTimeout(); timeUnit = timeoutRunnable.getTimeUnit(); } boolean offered; try { if (timeout == 0) { offered = workQueue.offer(command); } else { offered = workQueue.offer(command, timeout, timeUnit); } } catch (InterruptedException e) { throw new RejectedExecutionException("Thread is interrupted while offering work"); } if (!offered) { throw new RejectedExecutionException("Worker queue is full!"); } schedule(); } private void schedule() { //if it is already scheduled, we don't need to schedule it again. if (scheduled.get()) { return; } if (!workQueue.isEmpty() && scheduled.compareAndSet(false, true)) { try { executor.execute(this); } catch (RejectedExecutionException e) { scheduled.set(false); throw e; } } } public void run() { try { Runnable r; do { r = workQueue.poll(); if (r != null) { r.run(); } } while (r != null); } finally { scheduled.set(false); schedule(); } } 模块。除了开发人员工具React Native is not built on top of Node - 它还使用了Safari的JavaScript引擎JavaScriptCore。因此,当您运行应用程序时,path模块不存在,并且API客户端无法正常工作。

您需要直接使用the REST API与Google沟通。