Last active
August 5, 2022 19:31
-
-
Save roman01la/6fd5636303398813a1425e2947b1ce57 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
Thanks bookmarked!