-
-
Save groundedsage/941d0b06d614faec7730cb31fe49d9fe to your computer and use it in GitHub Desktop.
Access React Native compiled styles map using Clojure's keywords.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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