This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-01-27
Channels
- # aws-lambda (3)
- # beginners (3)
- # boot (327)
- # capetown (2)
- # cider (156)
- # cljs-dev (368)
- # cljsjs (13)
- # cljsrn (53)
- # clojure (403)
- # clojure-czech (5)
- # clojure-dev (4)
- # clojure-greece (2)
- # clojure-russia (72)
- # clojure-spec (12)
- # clojure-uk (129)
- # clojurescript (156)
- # core-async (1)
- # cursive (33)
- # datomic (35)
- # emacs (10)
- # events (1)
- # hoplon (4)
- # jobs-discuss (3)
- # klipse (1)
- # lein-figwheel (14)
- # leiningen (5)
- # luminus (5)
- # off-topic (15)
- # om (69)
- # om-next (2)
- # onyx (2)
- # parinfer (15)
- # perun (12)
- # re-frame (30)
- # reagent (7)
- # ring-swagger (8)
- # spacemacs (10)
- # specter (6)
- # untangled (69)
- # yada (13)
@anmonteiro do you have a usage from example? 🙂
specifically, how to add a
navigationOptions
static field to rum
component
class HomeScreen extends React.Component {
static navigationOptions = {
title: 'Welcome',
}; ...
@misha @anmonteiro Yeah that’s great! I’m going to try to get it to work with cljs next week.
@vikeri @anmonteiro I think this is it (did not try it yet, though): https://github.com/tonsky/rum/blob/gh-pages/examples/rum/examples/custom_props.cljs#L15-L33
(def props
{:msgData "Components can store custom data on the underlying React component."})
(rum/defcc custom-props < {:class-properties props} [this]
;; using aget to avoid writing externs
[:div (aget this "msgData")])
@misha Ok cool! I was thinking of trying to avoid the whole props thing and integrate it directly with re-frame
looks too javascripty. the only reasons I am keeping on reading the docs are: the native thread animations, and declarative settings.
@misha (Redux/Elm in CLJS): One single atom for state, update the state only with event handlers that can be dispatched to from anywhere in the app. Define subscriptions to parts of the state, defererence these subscriptions in your components and they will automatically update whenever that part of the state changes. Uses reagent as React wrapper.
Elm is a programming language that is like haskell but compiles to JS. Redux is probably the most popular way (along with Relay) of managing state in React
might be useful btw: https://www.youtube.com/watch?v=-jwQ3sGoiXg
@ejelome thanks, but think I'll pass for now (that's why I asked for just a few sentences)
@misha The foundation is from FRP (Functional Reactive Programming) and Unidirectional data flow. The data only flows in one direction. If you haven’t heard of it it’s quite a foreign concept but very intuitive once you grok it. I recommend reading the re-frame readme if you really want to understand it.
I am familiar with FRP, I just wanted to know what all the hype around reframe is about.
Ok great! Then it’s basically a very pragmatic but still elegant application to using FRP in UI development.
what I have is a few large atoms, derived from datascript, views, subscribed to those atoms (directly, or via smaller derived atoms in-between), and a bunch of functions, mutating those atoms (this is the piece to be replaced with events+dispatcher for event sourcing).
sounds pretty similar (on high level) to me (I read through the reframe docs a bit). does it? or am I missing something fundamental here?
@misha Not really, re-frame just takes care of everything for you in an opinionated to me mostly very good way. It adds things like middleware, so that you can log all your events etc.
@misha @vikeri I haven't tried it, just knew that CLJS + RN had historically had problems with Navigator and saw that which may be a step in a different direction!
I am trying to use google maps in react native. The react native docs suggest I use the airbnb react-native-maps. However it doesnt seem to work. I see that the airbnb react-native-maps is written as an es6 component (extends React.component and has a constructor) as opposed to the createClass. I am not sure where to look or how to call r/adapt-react-class for this component. Any ideas?
@rohit_ I think you can just call it normally
however, you may need to access the module as .-default
if it's a es6 module
like this: (def video (r/adapt-react-class (.-default (js/require "react-native-video/Video.js"))))
don't know if that's the issue you're seeing
but anyway I'm pretty sure ES6 classes should just work with adapt-react-class
ok yeah im trying to see how it works in both in the browser and on the web Thanks @pesterhazy
your suggestion was good for the web
@pesterhazy it doesnt seem to work for react-native-maps
@pesterhazy Is there a more idiomatic way to do that besides .-default
? I use this method, but all the warnings around default being a reserved keyword kind of scare me.
that's a static field (named "default") access on a js object. probably can't be more idiomatic than this
@misha I’m not sure how using aget or goog.object.get will resolve the warnings, as the compiler (only when compiling for production) seems to complain simply about the fact that i’m trying to access default
, and not the method by which i’m trying to access it.
maybe @anmonteiro knows
what's the problem? does it produce an error under advanced compilation?
@levitanong gets warning about accessing default
filed in advanced compilation with ~this:
(def video (r/adapt-react-class (.-default (js/require "react-native-video/Video.js"))))
if it's just a warning, don't worry about it
as long as it works
haha alrighty
thanks guys
@levitanong can you paste the warning you're getting though?
and is it at compile or runtime?
@anmonteiro just need to finish something, then will do!