for tailwind in general I'd recommend letting it process the build output, not the sources
if babel is going to rewrite the code this is also necessary, since it'll have no idea how to rewrite CLJS code
OK but how do I get the class into the build output?
I have tried the following iterations:
[:> rn/Text {:style "text-green-500"} "Hello!"]
[:> rn/Text {:class "text-green-500"} "Hello!"]
[:> rn/Text {:className "text-green-500"} "Hello!"]
[:> rn/Text {:class-name"text-green-500"} "Hello!"]
all were no goI added "./app/*.js" to my tailwind config but that isn't doing much either. that is where the JS build output lives
sorry I don't know how nativewind operates. I assumed it did the same as regular tailwind but that doesn't appear to be the case
so it likely won't recognize the code cljs generates
Oh sad đ I did see a cool https://www.juxt.pro/blog/clojurescript-native-apps-2021/ saying that it was easier to write the logic in cljs and the components in JavaScript so I might do that, but I wanted to try writing it in Cljs first so I can judge for myself
Might also spend more time getting https://github.com/vadimdemedes/tailwind-rn to work
Thanks for your help! I am a newb in clojurescript and would have probably spent an inordinate amount of time coming to the conclusion that youâve just provided me
I think the only thing you can't do is use the babel plugin to automatically wrap your components in styled
Got it, thanks. Do I need a tailwind job running on a watch basis?
I tried to wrap my components as per the Tailwind instruction but got errors for using the wrong kind of RN components
(def StyledText (styled rn/Text))
wouldnât be surprised if I am doing it totally wrong, as I said I am really new to cljswhat was the error you got?
I am away from the cljs project rn but I got something like âtext must be inside a Text componentâ from Expo
OK. Still not sure sure if it would work, but I think removing babel would be my first step and troubleshooting from there
Iâll try!
Thanks for your help
I got it working! I had to remove the babel plugin and configure a postcss config file
Hi, I'm trying to clean a clojurescript repository, I was thinking about using carve but it seems not to place so nicely with reframe, any advice ?
you can use the clj-kondo analysis to find dead re-frame subscriptions etc The keywords analysis has additional data about in which context they are used. it has support for re-frame. https://github.com/clj-kondo/clj-kondo/tree/master/analysis#context-data
Thank you I'll look into it
(mostly to remove dead code, for now)
In clojurescript how do I import a specific component from the Styled Components Native package: "styled-components/native"?
I want to use the styled.View component.
Hereâs the equivalent Typescript:
import styled from "styled-components/native"
...
export const AuthContainer = styled.View`
flex: 1;
`
I tried `
["styled-components/native" :as scn]
(defstyled auth-container (View. scn)
{:flex 1
:background-color "red"})
and that didnât work, nor did scn/View, nor :scn/View. Iâm using the https://github.com/dvingo/cljs-styled-components library. It doesnât describe how to do this.I would keep this section handy (provided you're using shadow-cljs): https://shadow-cljs.github.io/docs/UsersGuide.html#_using_npm_packages. I would give ["styled-components/native$default" :as scn] a try.
Ok, I tried that, yet I wasnât able to do scn/View.
Thanks though, I didnât know about the $default import suffix.
In the source for that project you linked the import is merely "styled-components", but I didn't have any luck with that myself. I looked over the repo for styled-components but couldn't find anything illuminating.
I may have found the answer to my original question with one line from the project docs:
...
- any react component, which will invoke styled on the component:
(defn my-component [props]
(dom/div {:className (goog.object/get props "className")}
(goog.object/get props "children")))
(defstyled example2 my-component {:border "1px solid"}).