From b172d60f1dc8df132959defd9737cb5894350306 Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Sat, 22 Jun 2019 20:21:19 +0300 Subject: [PATCH] dapp permissions sheet animation with native driver --- .../ui/screens/browser/permissions/views.cljs | 18 +++++++++++------- src/status_im/ui/screens/browser/styles.cljs | 7 +++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/status_im/ui/screens/browser/permissions/views.cljs b/src/status_im/ui/screens/browser/permissions/views.cljs index b408e2d267..32f900a433 100644 --- a/src/status_im/ui/screens/browser/permissions/views.cljs +++ b/src/status_im/ui/screens/browser/permissions/views.cljs @@ -16,23 +16,27 @@ [bottom-anim-value alpha-value] (anim/start (anim/parallel - [(anim/spring bottom-anim-value {:toValue -354}) - (anim/timing alpha-value {:toValue 0 - :duration 500})]))) + [(anim/spring bottom-anim-value {:toValue styles/panel-height + :useNativeDriver true}) + (anim/timing alpha-value {:toValue 0 + :duration 500 + :useNativeDriver true})]))) (defn show-panel-anim [bottom-anim-value alpha-value] (anim/start (anim/parallel - [(anim/spring bottom-anim-value {:toValue -20}) - (anim/timing alpha-value {:toValue 0.6 - :duration 500})]))) + [(anim/spring bottom-anim-value {:toValue 20 + :useNativeDriver true}) + (anim/timing alpha-value {:toValue 0.6 + :duration 500 + :useNativeDriver true})]))) (defn permission-details [requested-permission] (get browser.permissions/supported-permissions requested-permission)) (views/defview permissions-panel [[dapp? dapp] {:keys [dapp-name]}] - (views/letsubs [bottom-anim-value (anim/create-value -354) + (views/letsubs [bottom-anim-value (anim/create-value styles/panel-height) alpha-value (anim/create-value 0) current-permission (reagent/atom nil) update? (reagent/atom nil)] diff --git a/src/status_im/ui/screens/browser/styles.cljs b/src/status_im/ui/screens/browser/styles.cljs index 0b89b0bb67..6a1353f5c1 100644 --- a/src/status_im/ui/screens/browser/styles.cljs +++ b/src/status_im/ui/screens/browser/styles.cljs @@ -93,12 +93,15 @@ :background-color colors/black :opacity alpha-value}) +(def panel-height 354) + (defn permissions-panel [bottom-anim-value] - {:height 354 + {:height panel-height :position :absolute - :bottom bottom-anim-value + :transform [{:translateY bottom-anim-value}] :right 0 :left 0 + :bottom 0 :align-items :center :background-color :white :border-top-left-radius 8