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 {} :PureNativeButton #js {}
:TapGestureHandler #js {} :TapGestureHandler #js {}
:PanGestureHandler #js {} :PanGestureHandler #js {}
:TouchableHighlight #js {}
:LongPressGestureHandler #js {} :LongPressGestureHandler #js {}
:TouchableWithoutFeedback #js {} :TouchableWithoutFeedback #js {}
:createNativeWrapper identity}) :createNativeWrapper identity})

View File

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

View File

@ -2,9 +2,11 @@
(:require [oops.core :refer [oget]] (:require [oops.core :refer [oget]]
["react-native-reanimated" :default animated] ["react-native-reanimated" :default animated]
[reagent.core :as reagent] [reagent.core :as reagent]
[quo.design-system.colors :as colors]
["react-native-gesture-handler" ["react-native-gesture-handler"
:refer (TapGestureHandler PanGestureHandler LongPressGestureHandler :refer (TapGestureHandler PanGestureHandler LongPressGestureHandler
PureNativeButton TouchableWithoutFeedback PureNativeButton TouchableWithoutFeedback
TouchableHighlight
createNativeWrapper State)])) createNativeWrapper State)]))
(def tap-gesture-handler (def tap-gesture-handler
@ -23,6 +25,13 @@
(def touchable-without-feedback (def touchable-without-feedback
(reagent/adapt-react-class touchable-without-feedback-class)) (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 (def raw-button
(reagent/adapt-react-class (reagent/adapt-react-class
(createNativeWrapper (.createAnimatedComponent animated PureNativeButton) (createNativeWrapper (.createAnimatedComponent animated PureNativeButton)