Skip to content

Commit

Permalink
Lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ulisesmac committed Dec 13, 2024
1 parent 0bd6156 commit 0560f79
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/react_native/fast_image.cljs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
(ns react-native.fast-image
(:require
["react-native-fast-image" :as FastImage]
[clojure.string :as string]
[oops.core :as oops]
[react-native.core :as rn]
[reagent.core :as reagent]))
["react-native-fast-image" :as FastImage]
[clojure.string :as string]
[oops.core :as oops]
[react-native.core :as rn]
[reagent.core :as reagent]))

(defn- build-source
[source]
Expand All @@ -21,10 +21,11 @@

(defn- placeholder
[{:keys [style fallback-content error? loaded?]}]
[rn/view {:style (assoc style
:flex 1
:justify-content :center
:align-items :center)}
[rn/view
{:style (assoc style
:flex 1
:justify-content :center
:align-items :center)}
(cond
(and error? fallback-content) fallback-content
error? [rn/text "X"]
Expand All @@ -45,17 +46,18 @@
(fn [{:keys [source fallback-content on-error on-load] :as props}]
[:> FastImage
(assoc props
:source (build-source source)
:on-error #(on-image-error % on-error)
:on-load #(on-image-loaded % on-load))
:source (build-source source)
:on-error #(on-image-error % on-error)
:on-load #(on-image-loaded % on-load))
(when (or @error? (not @loaded?))
[placeholder
{:style (js->clj (:style props))
:fallback-content fallback-content
:error? @error?
:loaded? @loaded?}])])))

(defn- compare-sources [old-props new-props]
(defn- compare-sources
[old-props new-props]
(let [old-source (oops/oget old-props :source)
new-source (oops/oget new-props :source)]
(and old-source
Expand All @@ -66,4 +68,4 @@
(-> internal-fast-image
(reagent/reactify-component)
(rn/memo compare-sources)
(reagent/adapt-react-class)))
(reagent/adapt-react-class)))

0 comments on commit 0560f79

Please sign in to comment.