Skip to content

Instantly share code, notes, and snippets.

@roman01la
Last active August 5, 2022 19:31
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save roman01la/6fd5636303398813a1425e2947b1ce57 to your computer and use it in GitHub Desktop.
Save roman01la/6fd5636303398813a1425e2947b1ce57 to your computer and use it in GitHub Desktop.
Access React Native compiled styles map using Clojure's keywords.
(def stylesheet (.-StyleSheet ReactNative))
(defn create-stylesheet [styles]
(->> styles
(clj->js)
(.create stylesheet)
(js->clj)
(clojure.walk/keywordize-keys)))
; usage
(def styles
(create-stylesheet
{:container {:height 49
:backgroundColor "#eeeeee"}}))
(:container styles)
@arichiardi
Copy link

Thanks bookmarked!

@vinurs
Copy link

vinurs commented Feb 11, 2019

wow, thanks very much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment