From 6b3506c9810e349dd9f007dbb2770dff3ea2cba3 Mon Sep 17 00:00:00 2001 From: emizzle Date: Mon, 27 Apr 2020 21:39:33 +1000 Subject: [PATCH] fix: carousel image height on narrow devices Fixes #10427 Narrow devices were causing text in the intro carousel to grow to two lines on *the first* slide but not others, causing the height to be recalculated incorrectly on the last slide (that only had one line of text). Create a vector of atoms that can individually track the heights required for each slide independently. - Intro screen status: ready --- src/status_im/ui/screens/intro/views.cljs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/status_im/ui/screens/intro/views.cljs b/src/status_im/ui/screens/intro/views.cljs index 4fa6cd9d3e95..57b681c1db96 100644 --- a/src/status_im/ui/screens/intro/views.cljs +++ b/src/status_im/ui/screens/intro/views.cljs @@ -66,7 +66,8 @@ size (min @width @height) #_(- (min @width @height) #_(* 2 margin))] [react/view {:style {:flex 1} :on-layout (fn [e] - (reset! height (-> e .-nativeEvent .-layout .-height)))} + (let [new-height (-> e .-nativeEvent .-layout .-height)] + (swap! height #(if (pos? %) (min % new-height) new-height))))} [react/image {:source (:image s) :resize-mode :contain :style {:width size