[#5024] Fix for landscale layout on Backup Seed screen

Signed-off-by: Igor Mandrigin <i@mandrigin.ru>
This commit is contained in:
Dmitry Novotochinov 2018-07-17 10:29:37 +03:00 committed by Igor Mandrigin
parent 08a61b40cf
commit 3fd2aae932
No known key found for this signature in database
GPG Key ID: 4A0EDDE26E66BC8B
2 changed files with 22 additions and 13 deletions

View File

@ -90,15 +90,23 @@
(assoc :accessibility-label accessibility-label))
(if more-than-9 (i18n/label :t/counter-9-plus) value)]])))
(defn image-contain [_ _]
(let [content-width (reagent/atom 0)]
(reagent/create-class
{:reagent-render
(fn [{:keys [container-style style]} {:keys [image width height]}]
[react/view {:style (merge styles/image-contain container-style)
:on-layout #(reset! content-width (-> % .-nativeEvent .-layout .-width))}
[react/image {:source image
:resize-mode :contain
:style (merge style
{:width @content-width
:height (/ (* @content-width height) width)})}]])})))
(defview image-contain [{:keys [container-style style]} {:keys [image width height]}]
(letsubs [content-width (reagent/atom 0)
{window-width :width window-height :height} [:dimensions/window]]
[react/view {:style (merge styles/image-contain container-style)
:on-layout #(reset! content-width (-> % .-nativeEvent .-layout .-width))}
[react/image {:source image
:resize-mode :contain
:style (merge style
(if (> window-height window-width)
{:width (* @content-width
(if (< window-height 600)
0.6
1))
:height (/ (* @content-width height
(if (< window-height 600)
0.6
1))
width)}
{:width @content-width
:height (* window-height 0.6)}))}]]))

View File

@ -8,7 +8,8 @@
:margin-horizontal 26})
(def intro-image
{:padding-bottom 10})
{:padding-bottom 10
:align-items :center})
(def intro-text
{:text-align :center