Fork me on GitHub

(defn pulsing-text [message]
  (fn [message]
    (let [this (atom nil)]
        { :display-name "pulsing-text"

         #(ocall @this :bounce 800)

         (fn []
           [animatable/text {:ref #(reset! this %)
                             :style {:font-size 16
                                     :text-align :center
                                     :color theme/alternate-text-color}}


Seems to do the trick; can I do any better than that?


Woops, yes I can; that's a form-2 and a form-3. 😛


A new snapshot version of re-frame-trace is out, it has a pretty cool snapshotting feature. It lets you take a snapshot of app-db and then reset to it later on. Just add [ "0.1.14-20171204.040033-2"]. One thing to note, snapshots are only saved for that browser session, they're not saved to localstorage (because serialisation can be messy)


This is stuff that I’ve been imagining since I first learnt about reagent. Is it present in other libs?

Guilhem Brouat 10:12:39

Hello ! I'm trying to get a very simplified version of the todomvc example. I have the following default db, sub and view for my tasks list :

Guilhem Brouat 10:12:37

But I get this error : Uncaught Error: [object Object] is not ISeqable at Object.cljs$core$seq [as seq]


@ganlhi The code you posted is incomplete.


Ah, sorry, opening in new windows helps, but expanding it inline for some reason does not.


@ganlhi you need to dereference the subscription


a.g. (for [todo @todos] ...) instead of (for [todo todos] ...)


in the error Uncaught Error: [object Object] is not ISeqable at Object.cljs$core$seq [as seq] - the for is trying to open a seq over the subscription's reaction object, but it can't

Guilhem Brouat 10:12:38

indeed it works much better 🙂


Has anyone solved making deep links work with re-frame with the criteria that we need to check for the presence of a cookie in order to display certain routes


Maybe this is a use case for interceptors?


Rookie question: I’ve imported react-native-maps component like this .

(def map-view (r/adapt-react-class (js/require "react-native-maps")))

(defn my-map [coords markers]
  [map-view {:style {:flex 1}
             :initialRegion coords}])
Now I need to create a a Marker on the Map. It’s supposed to be a nested component “MapView.Marker”. How do I create the marker? In ‘normal React’ it happens like this
  { => (
How should do I refer to “MapView.Marker”? It should happen maybe something like this:
(defn my-map [coords markers]
  [map-view {:style {:flex 1}
             :initialRegion coords}
     [map-view/Marker {:blabablab 1231}]
But what’s the correct syntax for map-view/Marker?


@valtteri I believe

;; add `(:require [goog.object :as gobj])`

(def react-map-view (js/require "react-native-maps"))
(def map-view (r/adapt-react-class react-map-view))
(def map-viewer-marker (r/adapt-react-class (gobj/get react-map-view "Marker")))


I could be incorrect though 🙂


what’s a reasonable way to (using secretary routes and re-frame) to restrict routes based on some value in the app-db?


my current approach is to dispatch event from the secretary route, check my condition in the event subscriber/handler, and dispatch another event resetting the current page if the condition isn’t met


Hey guys, I find re-frame absolutely amazing and I personally use any chance I get. However, due to some external circumstances I might find myself in Javascript land soon. I was wondering. If I had to stick completely to Javascript, what would I use to emulate the re-frame framework the best? I’m looking at React+Redux but I was wondering if there was anything better?


@kasuko I most often hear redux compared with re-frame. I imagine there are a bunch of redux variants, but it seems like a reasonable choice


@kasuko You might give MobX a look. Here is one write-up comparing that and Redux:


Hi, i’m implementing a quick drag/drop implementation with re-frame. So far, everything is working pretty good. I have event handlers in my ‘draggable’ that set the item being dragged in the app-db,etc. This works fine. Similarly, i’ve on-dragover, etc handlers that change some local state in the drop-target component to highlight the drop-target, etc etc. This all works fine. What, im trying to do now, is basically have any drop target on the screen change some state when the ‘draggable’ on-drag fires and I set my dragging state in the app-db. I have subscription on the drop-target component that looks at the dragging state. The issue is that it’s not reflecting the state of the app-db until after I stop dragging. Here’s a snippet of the drop-target code:

(defn field-drop-target
  [prev-field-id group-id]
  (let [dragged (rf/subscribe [:dragged])
        is-dragging? (some? @dragged)
        width (r/atom "10px")
        background-color (r/atom "white")
        border (r/atom "none")
        showtarget (fn [] (do
                            (reset! width "100px")
                            (reset! background-color "lightgrey")
                            (reset! border "1px dashed black")))
        hidetarget (fn [] (do
                            (reset! width "20px")
                            (reset! background-color "white")
                            (reset! border "none")))

        curpageid (rf/subscribe [:cur-page-id])]
    (fn [prev-field-id group-id]
is-dragging? doesn’t become true, until after I drop or stop dragging. Even though it’s set in the db. I figure this has something to do with the event loop, etc, but I’m just not sure how to get around it..