【发布时间】:2019-06-16 16:42:44
【问题描述】:
我是 Clojurescript 的新手。我正在尝试在基于 java 的 react native 模块中调用一个函数。所有本机模块都在本机反应中返回承诺,我试图让 ClojureScript 位正确,但在编译期间我从 Node 收到一条消息 "UnhandledPromiseRejectionWarning: Unhandled Promise Rejection..." 。我猜 Node 认为从 Clojurescript 生成的 JS 没有 'reject' 子句。
我的代码如下所示:
(when platform/android?
(try
(->
((.-isAvailable RNTextDirection)) ;1st native module function
(.then
(fn [value]
(when value
(->
((.-isRTL RNTextDirection) text) ;2nd native module function
(.then (fn [value] ( (or value (right-to-left-text? text) (assoc :rtl? true))))
(.catch (fn [error] ( (right-to-left-text? text) (assoc :rtl? true))))))))
(.catch (fn [error] ( (right-to-left-text? text) (assoc :rtl? true)))))
(catch js/Object err ( (right-to-left-text? text) (assoc :rtl? true))))))
谁能帮我理解这里缺少什么?谢谢!
【问题讨论】:
-
我在没有任何线索的情况下问这个问题:你确定
((.-isAvailable RNTextDirection))周围的双括号吗?是你想要的 - 它将执行.-isAvailable的结果,这对我来说听起来很预言?
标签: node.js react-native react-native-android clojurescript