Fork me on GitHub
#re-frame
<
2019-02-02
>
lilactown00:02:58

the tricky bit is getting it to auto-dismiss

lilactown00:02:29

otherwise yes, it wouldn't be hard to just put a thing in your app-db to trigger a render of the notification

Charles00:02:11

The auto-dismiss portion can be a setTimeout that does something along the lines of (rf/dispatch [:clear-notification ...]).

hoopes00:02:33

i’m trying to not have to call addNotification after some subscription though - i’m looking at material ui snackbar now. have you used one that you like?

Charles00:02:09

I'm confused about how you'd want to get the notification to pop up... usually the notification is basically a side-effect of some event (or something that has happened)

hoopes00:02:01

right - i’d dispatch :add-notification, which would append some map to my :notifications list in the app db (so i have 3 notification maps in the list in the db) - i’d like to have some view that says for notification in notifications: [my-notification notification-props] (pseudocode…)

hoopes00:02:35

and bada bing, 3 notifications pop up 🙂

Charles00:02:37

Yep -- that's basically how I've done it. We rolled our own with relatively little code

Charles00:02:42

(rf/dispatch [:add-notification ...]) (rf/dispatch [:clear-notification notification-id]) and (rf/subscribe [notifications])

hoopes00:02:01

and the view consumes the subscription, and your custom notifications pop up

👍 5