Skip to content

Commit

Permalink
fix: carousel image height on narrow devices
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emizzle committed Apr 29, 2020
1 parent 35dd4b0 commit 6b3506c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/status_im/ui/screens/intro/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b3506c

Please sign in to comment.