This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-24
Channels
- # architecture (4)
- # aws (1)
- # beginners (76)
- # boot (172)
- # cider (17)
- # cljs-dev (10)
- # cljs-experience (24)
- # cljsrn (45)
- # clojure (129)
- # clojure-berlin (1)
- # clojure-finland (1)
- # clojure-italy (8)
- # clojure-seattle-old (1)
- # clojure-sg (1)
- # clojure-spec (31)
- # clojure-uk (28)
- # clojurescript (88)
- # cursive (11)
- # data-science (1)
- # datomic (44)
- # fulcro (48)
- # hoplon (5)
- # jobs (3)
- # jobs-discuss (1)
- # leiningen (6)
- # luminus (42)
- # lumo (17)
- # off-topic (9)
- # om (29)
- # onyx (15)
- # pedestal (7)
- # protorepl (20)
- # re-frame (24)
- # reagent (46)
- # ring-swagger (2)
- # specter (2)
- # sql (3)
- # uncomplicate (58)
- # unrepl (29)
- # yada (5)
Hi, I’m looking for a remote (GMT+8) Clojure(script) position (full-time or contract), I’m the original author of https://github.com/seantempesta/expo-cljs-template and https://github.com/tiensonqin/lymchat. Looking forward to talk with you!
@mfm Thank you very much.
Do you know how to write the tabBarIcon here
class MyHomeScreen extends React.Component {
static navigationOptions = {
tabBarLabel: 'Home',
// Note: By default the icon is only shown on iOS. Search the showIcon option below.
tabBarIcon: ({ tintColor }) => (
<Image
source={require('./chats-icon.png')}
style={[styles.icon, {tintColor: tintColor}]}
/>
),
};
render() {
with clojurescript? I'd like to add and icon to my tabnavigator but I have aridity error :thinking_face:Here is how I've written
(TabNavigator
(clj->js {:swipeEnabled true
:initialRouteName "boxes-view"
:tabBarPosition "bottom"
:navigationOptions {:tabBarVisible true
:tabBarIcon (fn [{:keys [tintColor]}][Image {:source (js/require "./images/linfa_logo.png") :style {:tintColor tintColor} }])
}}))
@manu: That tells Reagent to expect a React component, rather than a Reagent component.
@seantempesta thanks! I saw it on your repository cljs-react-navigation
!
Yeah…I need to remove those. It just confuses people.
How you import my library?
(def image (r/adapt-react-class Image))
You don’t have to import any symbol to use :>
. When Reagent is reading the vector it checks to see if the first element is that symbol. Then it assumes the rest of the vector is a react component.
[:> Image {:source "asdf.jpg"}]
Will automatically adapt the Image class and convert the props to js using clj->js
hahah yeah that symbol is so confusing because you can't google it!
or even search the source for it
when I first saw it I was like wat 🙃
@seantempesta this is my code
(def Boxes-View (r/reactify-component boxes-view))
(def img* (adapt-react-class (.-Image react)))
(aset Boxes-View "navigationOptions" (clj->js {:tabBarLabel "Home"
:tabBarIcon (fn [{:keys [tintColor focused ]}]
[img* {:source (js/require "./images/linfa_logo.png") :style {:tintColor tintColor} }])}))
I've this error
Objects are not valid as a React child (found: object with keys {name, id, class}). If you meant to render a collection of children, use an array instead
@manu: You might have to render an element
as the return value for the tabBarIcon fn.
I found it incredibly confusing to remember when to convert the props or when to return a component vs an element, so I created the cljs-react-navigation
library to take care of those details.
I think you can do that via (r/as-element [img* {:source (js/require "./images/linfa_logo.png")...])
I believe an element is an instance of a component.
But if you use my library it’ll take care of all the converting for you.
Oh cool!
Yeah. I banged my head against several walls until I finally gave up and just decided to spec
the entire API. They don’t make it easy either! Most of it isn’t documented so you have to dig around in the source code to figure out what the attributes are and what the expected return values need to be.
Thanks! Github stars are appreciated. I’m looking for some contracting work at the moment, and I think those stars help. 🙂