Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save groundedsage/941d0b06d614faec7730cb31fe49d9fe to your computer and use it in GitHub Desktop.
Save groundedsage/941d0b06d614faec7730cb31fe49d9fe 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment