Skip to content

Instantly share code, notes, and snippets.

@roman01la
Last active August 5, 2022 19:31
Show Gist options
  • Select an option

  • Save roman01la/6fd5636303398813a1425e2947b1ce57 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

Thanks bookmarked!

@vinurs
Copy link
Copy Markdown

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