Skip to content

Commit

Permalink
(0.72.3) cleanup and make linter happy
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Aug 29, 2023
1 parent d88b4a4 commit 5871040
Show file tree
Hide file tree
Showing 19 changed files with 237 additions and 139 deletions.
5 changes: 4 additions & 1 deletion src/quo/animated.cljs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
(ns quo.animated
(:refer-clojure :exclude [abs set delay divide])
(:require ["react-native-reanimated" :default animated :refer (clockRunning EasingNode)]
(:require ["react-native-reanimated" :default animated :refer
(clockRunning
; EasingNode
)]
["react-native-redash" :as redash]
[oops.core :refer [ocall oget]]
[quo.gesture-handler :as gh]
Expand Down
9 changes: 6 additions & 3 deletions src/quo/components/animated/pressable.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
(fn []
(animated/with-timing-transition active
{:duration (animated/cond* active time-in time-out)
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;commented out to upgrade react-native-reanimated
;to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; :easing
;
Expand All @@ -103,7 +104,8 @@
(when (and on-long-press
(= gesture-state (:active gesture-handler/states)))
(on-long-press)
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;commented out to upgrade react-native-reanimated to v3 and
;react-native to 0.72
;TODO: replace this with an updated implementation
; (animated/set-value state
; (:undetermined
Expand All @@ -115,7 +117,8 @@
(when on-press
(animated/cond* (= state (:end gesture-handler/states))
[
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;commented out to upgrade react-native-reanimated to v3 and react-native to
;0.72
;TODO: replace this with an updated implementation
; (animated/set state (:undetermined
; gesture-handler/states))
Expand Down
3 changes: 2 additions & 1 deletion src/quo/components/animated_header.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
animation (animated/with-timing-transition
animation-value
{:duration 250
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;commented out to upgrade react-native-reanimated to v3 and react-native to
;0.72
;TODO: replace this with an updated implementation
; :easing (:ease-in animated/easings)
})
Expand Down
83 changes: 47 additions & 36 deletions src/quo/components/bottom_sheet/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

(defn bottom-sheet-hooks
[props]
(let [{on-cancel :onCancel
(let [{; on-cancel :onCancel
disable-drag? :disableDrag?
show-handle? :showHandle?
visible? :visible?
Expand Down Expand Up @@ -51,19 +51,25 @@
;; implemented
;; https://github.com/wix/react-native-navigation/issues/7225
0))
min-height (+ (* styles/vertical-padding 2) (:bottom safe-area))
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: uncomment this when this let binding is in use
; min-height (+ (* styles/vertical-padding 2) (:bottom safe-area))
max-height (- window-height (:top safe-area))
visible (react/state false)

master-translation-y (animated/use-value 0)
master-velocity-y (animated/use-value (:undetermined gesture-handler/states))
master-state (animated/use-value (:undetermined gesture-handler/states))
tap-state (animated/use-value 0)
manual-open (animated/use-value 0)
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; manual-open (animated/use-value 0)
manual-close (animated/use-value 0)
offset (animated/use-value 0)
drag-over (animated/use-value 1)
clock (animated/use-clock)
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; offset (animated/use-value 0)
; drag-over (animated/use-value 1)
; clock (animated/use-clock)
tap-gesture-handler (animated/use-gesture {:state tap-state})
on-master-event (animated/use-gesture
{:translationY master-translation-y
Expand All @@ -73,41 +79,45 @@
sheet-height (min max-height
(+ styles/border-radius @height))

open-snap-point (animated/use-value 0)
close-snap-point 0
on-close (fn []
(when @visible
(reset! visible false)
(reset! height 0)
(when on-cancel
(on-cancel))))
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; open-snap-point (animated/use-value 0)
; close-snap-point 0
; on-close (fn []
; (when @visible
; (reset! visible false)
; (reset! height 0)
; (when on-cancel
; (on-cancel))))
close-sheet (fn []
(animated/set-value manual-close 1))
on-snap (fn [pos]
(when (= close-snap-point (aget pos 0))
(on-close)))
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; on-snap (fn [pos]
; (when (= close-snap-point (aget pos 0))
; (on-close)))
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; interrupted (animated/and* (animated/eq master-state (:began gesture-handler/states))
; (animated/clock-running clock))
translate-y (react/use-memo
(fn []
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; (animated/with-easing
; {:value (animated/cond* (animated/less-or-eq
; master-translation-y 0)
; (animated/divide
; master-translation-y
; 2)
; master-translation-y)
; :velocity master-velocity-y
; :offset offset
; :state master-state
; :animation-over drag-over
; :snap-points [open-snap-point close-snap-point]})
)
[])
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; translate-y (react/use-memo
; (fn []
; (animated/with-easing
; {:value (animated/cond* (animated/less-or-eq
; master-translation-y 0)
; (animated/divide
; master-translation-y
; 2)
; master-translation-y)
; :velocity master-velocity-y
; :offset offset
; :state master-state
; :animation-over drag-over
; :snap-points [open-snap-point close-snap-point]})
; )
; [])
opacity (react/use-memo
(fn []
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
Expand Down Expand Up @@ -213,7 +223,8 @@
[animated/view
{:style (merge (styles/content-container window-height)
{:transform [{:translateY (* window-height 2)
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;commented out to upgrade react-native-reanimated to v3 and
;react-native to 0.72
;TODO: replace this with an updated implementation
; (if (= sheet-height max-height)
; (animated/add
Expand Down
13 changes: 9 additions & 4 deletions src/quo/components/controls/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
(defn control-builder
[component]
(fn [props]
(let [{:keys [value onChange disabled]}
(let [{:keys [
; value
onChange disabled]}
(bean/bean props)
state (animated/use-value 0)
tap-state (animated/use-value (:undetermined gh/states))
Expand All @@ -32,9 +34,12 @@
(:lazy
animated/springs)))
[])
press-end (fn []
(when (and (not disabled) onChange)
(onChange (not value))))]
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; press-end (fn []
; (when (and (not disabled) onChange)
; (onChange (not value))))
]
;commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;TODO: replace this with an updated implementation
; (animated/code!
Expand Down
30 changes: 20 additions & 10 deletions src/quo/previews/text.cljs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
(ns quo.previews.text
(:require [quo.animated :as animated]
[quo.core :as quo]
[quo.design-system.colors :as colors]
[quo.previews.preview :as preview]
[quo.react-native :as rn]
[reagent.core :as reagent]))
(:require
; [quo.animated :as animated]
[quo.core :as quo]
[quo.design-system.colors :as colors]
[quo.previews.preview :as preview]
[quo.react-native :as rn]
[reagent.core :as reagent]))

(def all-props
(preview/list-comp [size [:tiny :small :base :large :x-large :xx-large]
Expand Down Expand Up @@ -70,8 +71,12 @@

(defn cool-preview
[]
(let [state (reagent/atom {})
animation (animated/value 0)]
(let [state (reagent/atom {})
;;;; Animated.Code is deprecated with reanimated version 1.
;;;; commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;;;; TODO: replace this with an updated implementation
; animation (animated/value 0)
]
(fn []
[rn/view
{:margin-bottom 50
Expand All @@ -84,8 +89,13 @@
[rn/view {:padding-vertical 16}
[quo/text
(merge @state
(when (:animated? @state)
{:opacity animation}))
; (when (:animated? @state)
;;;; Animated.Code is deprecated with reanimated version 1.
;;;; commented out to upgrade react-native-reanimated to v3 and react-native to 0.72
;;;; TODO: replace this with an updated implementation
; {:opacity animation}
; )
)
"This is a demo text 1 2 0 2x2 0x0"]]])))

(defn preview-text
Expand Down
22 changes: 13 additions & 9 deletions src/quo2/components/drawers/drawer_buttons/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -129,53 +129,57 @@
(reanimated/animate-shared-value-with-delay bottom-view-top
(:height (rn/get-screen))
animations-duration
:easing4
; :easing4
animations-delay)
(reanimated/animate-shared-value-with-delay
height
max-height
animations-duration
:easing4
; :easing4
animations-delay)
(reanimated/animate-shared-value-with-delay
top-padding
(+ 68 (safe-area/get-top))
animations-duration
:easing4
; :easing4
animations-delay)
(reanimated/animate-shared-value-with-delay
top-children-opacity
0
animations-duration
:easing4 animations-delay)
; :easing4
animations-delay)
(reanimated/animate-shared-value-with-delay
top-title-opacity
0
0
:linear
; :linear
(+ animations-delay animations-duration 500)))
reset-top-animation (fn []
(reanimated/set-shared-value top-title-opacity 1)
(reanimated/animate-shared-value-with-delay bottom-view-top
80
animations-duration
:easing4
; :easing4
50)
(reanimated/animate-shared-value-with-timing
height
default-height
animations-duration
:easing4)
; :easing4
)
(reanimated/animate-shared-value-with-timing
top-padding
12
animations-duration
:easing4)
; :easing4
)
(reanimated/animate-shared-value-with-timing
top-children-opacity
1
animations-duration
:easing4))]
; :easing4
))]
(rn/use-effect (fn []
(when on-init
(on-init reset-top-animation))))
Expand Down
7 changes: 6 additions & 1 deletion src/quo2/components/loaders/skeleton.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
{:transform [{:translateX translate-x}]}
{:width window-width
:height "100%"})]
(reanimated/animate-shared-value-with-repeat translate-x window-width 1000 :linear (- 1) false)
(reanimated/animate-shared-value-with-repeat translate-x
window-width
1000
; :linear
(- 1)
false)
[masked-view/masked-view
{:style {:height message-skeleton-height}
:maskElement (reagent/as-element
Expand Down
12 changes: 7 additions & 5 deletions src/quo2/components/record_audio/record_audio/helpers.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@
shared-value
value
duration
:linear))
; :linear
))

(defn animate-linear-with-delay
[shared-value value duration delay]
(reanimated/animate-shared-value-with-delay
shared-value
value
duration
:linear
; :linear
delay))

(defn animate-linear-with-delay-loop
Expand All @@ -24,7 +25,7 @@
shared-value
value
duration
:linear
; :linear
delay
-1))

Expand All @@ -34,15 +35,16 @@
shared-value
value
duration
:easing1))
; :easing1
))

(defn animate-easing-with-delay
[shared-value value duration delay]
(reanimated/animate-shared-value-with-delay
shared-value
value
duration
:easing1
; :easing1
delay))

(defn set-value
Expand Down
Loading

0 comments on commit 5871040

Please sign in to comment.