Disable by default list item animations on android

Use highlight for touchable feedback

Signed-off-by: Gheorghe Pinzaru <feross95@gmail.com>
This commit is contained in:
Gheorghe Pinzaru 2020-07-14 12:13:43 +03:00
parent 292df1439c
commit 923beb5f26
No known key found for this signature in database
GPG Key ID: C9A094959935A952
3 changed files with 13 additions and 2 deletions

View File

@ -164,6 +164,7 @@
:PureNativeButton #js {}
:TapGestureHandler #js {}
:PanGestureHandler #js {}
:TouchableHighlight #js {}
:LongPressGestureHandler #js {}
:TouchableWithoutFeedback #js {}
:createNativeWrapper identity})

View File

@ -2,6 +2,7 @@
(:require [quo.react-native :as rn]
[quo.platform :as platform]
[quo.haptic :as haptic]
[quo.gesture-handler :as gh]
[quo.design-system.spacing :as spacing]
[quo.design-system.colors :as colors]
[quo.components.text :as text]
@ -153,7 +154,7 @@
:or {subtitle-max-lines 1
theme :main
haptic-feedback true
animated true
animated platform/ios?
haptic-type :selection}}]
(let [theme (if disabled :disabled theme)
{:keys [icon-color text-color icon-bg-color
@ -167,7 +168,7 @@
(not on-long-press))
rn/view
animated animated/pressable
:else rn/touchable-opacity)]
:else gh/touchable-hightlight)]
[rn/view {:background-color (if (and (= accessory :radio) active)
active-background
passive-background)}

View File

@ -2,9 +2,11 @@
(:require [oops.core :refer [oget]]
["react-native-reanimated" :default animated]
[reagent.core :as reagent]
[quo.design-system.colors :as colors]
["react-native-gesture-handler"
:refer (TapGestureHandler PanGestureHandler LongPressGestureHandler
PureNativeButton TouchableWithoutFeedback
TouchableHighlight
createNativeWrapper State)]))
(def tap-gesture-handler
@ -23,6 +25,13 @@
(def touchable-without-feedback
(reagent/adapt-react-class touchable-without-feedback-class))
(def touchable-hightlight-class (reagent/adapt-react-class TouchableHighlight))
(defn touchable-hightlight [props & children]
(into [touchable-hightlight-class (merge {:underlay-color (:interactive-02 @colors/theme)}
props)]
children))
(def raw-button
(reagent/adapt-react-class
(createNativeWrapper (.createAnimatedComponent animated PureNativeButton)