Increase long press move distance
Fix android password visibility change Do not change secure-text-entry on android password visiblity Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
parent
7007b790d5
commit
bdb4d7fe35
|
@ -213,19 +213,19 @@
|
|||
|
||||
(defn with-easing
|
||||
[{val :value
|
||||
:keys [snap-points velocity offset state easing duration on-snap]
|
||||
:keys [snap-points velocity offset state easing duration
|
||||
animation-over]
|
||||
:or {duration 250
|
||||
animation-over (value 1)
|
||||
easing (:ease-out easings)}}]
|
||||
(let [position (value 0)
|
||||
c (clock)
|
||||
animation-over (value 1)
|
||||
interrupted (and* (eq state (:began gh/states))
|
||||
(clock-running c))
|
||||
vel (multiply velocity 1.5)
|
||||
to (snap-point position vel snap-points)
|
||||
finish-animation [(set offset position)
|
||||
(stop-clock c)
|
||||
(call* [position] on-snap)
|
||||
(set animation-over 1)]]
|
||||
(block
|
||||
[(cond* interrupted finish-animation)
|
||||
|
|
|
@ -84,19 +84,17 @@
|
|||
:animation animation}))
|
||||
[type])
|
||||
handle-press (fn [] (when on-press (on-press)))
|
||||
handle-press-start (fn [] (when on-press-start (on-press-start)))
|
||||
long-gesture-handler (fn [^js evt]
|
||||
long-gesture-handler (react/callback
|
||||
(fn [^js evt]
|
||||
(let [state (-> evt .-nativeEvent .-state)]
|
||||
(when (and on-press-start
|
||||
(= state (:began gesture-handler/states)))
|
||||
(on-press-start))
|
||||
(when (and on-long-press
|
||||
(= (-> evt .-nativeEvent .-state)
|
||||
(:active gesture-handler/states)))
|
||||
(= state (:active gesture-handler/states)))
|
||||
(on-long-press)
|
||||
(animated/set-value state (:undetermined gesture-handler/states))))]
|
||||
(animated/code!
|
||||
(fn []
|
||||
(when on-press-start
|
||||
(animated/cond* (animated/eq state (:began gesture-handler/states))
|
||||
(animated/call* [] handle-press-start))))
|
||||
[on-press-start])
|
||||
(animated/set-value state (:undetermined gesture-handler/states)))))
|
||||
[on-long-press on-press-start])]
|
||||
(animated/code!
|
||||
(fn []
|
||||
(when on-press
|
||||
|
@ -109,6 +107,7 @@
|
|||
{:enabled (boolean (and on-long-press (not disabled)))
|
||||
:on-handler-state-change long-gesture-handler
|
||||
:min-duration-ms long-press-duration
|
||||
:max-dist 22
|
||||
:ref long-press-ref}
|
||||
[animated/view {:accessible true
|
||||
:accessibility-label accessibility-label}
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
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)
|
||||
body-ref (react/create-ref)
|
||||
master-ref (react/create-ref)
|
||||
|
@ -91,9 +92,9 @@
|
|||
:velocity master-velocity-y
|
||||
:offset offset
|
||||
:state master-state
|
||||
:on-snap on-snap
|
||||
:animation-over drag-over
|
||||
:snap-points [open-snap-point close-snap-point]}))
|
||||
[on-close])
|
||||
[])
|
||||
opacity (react/use-memo
|
||||
(fn []
|
||||
(animated/cond*
|
||||
|
@ -104,6 +105,12 @@
|
|||
:outputRange [1 0]
|
||||
:extrapolate (:clamp animated/extrapolate)})))
|
||||
[])]
|
||||
(animated/code!
|
||||
(fn []
|
||||
(animated/cond* (animated/and* (animated/eq master-state (:end gesture-handler/states))
|
||||
(animated/not* drag-over))
|
||||
(animated/call* [translate-y] on-snap)))
|
||||
[on-snap])
|
||||
(animated/code!
|
||||
(fn []
|
||||
(animated/block
|
||||
|
|
|
@ -59,7 +59,6 @@
|
|||
{:min-height (size->container-size size)
|
||||
:padding-vertical 8
|
||||
:flex-direction :row
|
||||
:flex 1
|
||||
:align-items :center
|
||||
:justify-content :space-between})}]
|
||||
children))
|
||||
|
|
|
@ -169,7 +169,8 @@
|
|||
:on-press #(reset! visible true)}
|
||||
|
||||
:else after)
|
||||
secure (and secure-text-entry (not @visible))
|
||||
secure (and secure-text-entry
|
||||
(or platform/android? (not @visible)))
|
||||
on-cancel (fn []
|
||||
(when on-cancel
|
||||
(on-cancel))
|
||||
|
@ -178,6 +179,7 @@
|
|||
(and platform/ios? (= keyboard-type "visible-password"))
|
||||
"default"
|
||||
|
||||
;; NOTE: Now switching dynamically brakes android input
|
||||
(and platform/android? secure-text-entry @visible)
|
||||
"visible-password"
|
||||
|
||||
|
|
Loading…
Reference in New Issue