Last active
June 11, 2016 18:59
-
-
Save tylermorten/64657949067f72a449a87801574a15c7 to your computer and use it in GitHub Desktop.
This file contains 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
(ns style-sheet) | |
(def ReactNative (js/require "react-native")) | |
(defn platform-style | |
[style-map & addl] | |
(let [platform (-> (.. ReactNative -Platform -OS) keyword)] | |
(cond-> style-map | |
(contains? style-map platform) (-> | |
(merge (get style-map platform)) | |
(dissoc platform)) | |
(map? (first addl)) (merge (first addl))))) | |
(comment | |
(def style {:container {:flex 1 | |
:android {:backgroundColor "#ccc"} | |
:ios {:backgroundColor "#000"}}}) | |
(view {:style (platform-style (style :container) {:addlStyle "blah blah"}}) ...)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment