diff --git a/src/react_native/core.cljs b/src/react_native/core.cljs index a7d6677e0b..940422a901 100644 --- a/src/react_native/core.cljs +++ b/src/react_native/core.cljs @@ -16,7 +16,17 @@ (def view (reagent/adapt-react-class (.-View ^js react-native))) (def scroll-view (reagent/adapt-react-class (.-ScrollView ^js react-native))) -(def image (reagent/adapt-react-class (.-Image ^js react-native))) + +(def ^:private image-native + (reagent/adapt-react-class (.-Image ^js react-native))) + +(defn image + [{:keys [source] :as props}] + [image-native + (if (string? source) + (assoc props :source {:uri source}) + props)]) + (defn image-get-size [uri callback] (.getSize ^js (.-Image ^js react-native) uri callback)) (def text (reagent/adapt-react-class (.-Text ^js react-native))) (def text-input (reagent/adapt-react-class (.-TextInput ^js react-native)))