Fork me on GitHub

Hi! I’m trying to use react-native-view-overflow but I’m not sure how to type the required code in ClojureScript. I have the following inside one of my view components:

[:> rn/FlatList
     {:data (clj->js (mapv (fn [n] {:key n}) (range 0 100)))
      :horizontal true
      ;; :Item-separator-component #(r/as-element [separator])
      :render-item (fn [details] (r/as-element [cell (js->clj details)]))}]
According to the docs ( I need to wrap whatever I put into render-item with ViewOverflow. Just making the first thing in cell a ViewOverflow doesn’t seem to do the job…


For completeness, this is cell:

(defn cell [details]
  (let [item (details "item")
        key (item "key")]
    [:> rn/View {:style {:width 80
                         :background-color (if (= 0 (mod key 2)) "#dd666611" "#ffffff33")}}
     [:> rn/Text {:style {:left -15 :width 30 :text-align "center"}} key]]))


Is there an easy way to tell if something is a SyntheticEvent?


@pcj there doesn’t seem to be an official way to do this, but an easy heuristic might be to check for the nativeEvent property

👍 4

is it possible to use r/with-let inside a macro? AFAICT when it expands finally cannot be resolved, giving me Use of undeclared Var my.namespace/finally