Fix segmented tab component (#15001)

Fixes #14999 

Fix UI regression in the segmented tab component, introduced by PR https://github.com/status-im/status-mobile/pull/14883.

No area was impacted because segmented tabs are not used yet.
This commit is contained in:
Icaro Motta 2023-02-07 08:27:27 -03:00 committed by GitHub
parent f8b5b35063
commit 98b219191f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 8 deletions

View File

@ -29,11 +29,12 @@
{:margin-left (if (= 0 indx) 0 2)
:flex 1}
[tab/view
{:id id
:segmented true
:size size
:active (= id active-id)
:on-press #(do (reset! active-tab-id %)
(when on-change
(on-change %)))}
{:id id
:segmented? true
:size size
:active (= id active-id)
:on-press (fn [tab-id]
(reset! active-tab-id tab-id)
(when on-change
(on-change tab-id)))}
label]])]))))

View File

@ -31,11 +31,16 @@
{:flex-direction :row})
(defn tab
[{:keys [size disabled background-color show-notification-dot?]}]
[{:keys [background-color
disabled
segmented?
show-notification-dot?
size]}]
(let [border-radius (size->border-radius size)
padding (size->padding-left size)]
(merge {:height size
:align-items :center
:justify-content :center
:flex-direction :row
:border-top-left-radius border-radius
:border-bottom-left-radius border-radius
@ -48,6 +53,8 @@
{:padding-right 1}
{:border-radius border-radius
:padding-right padding})
(when segmented?
{:flex 1})
(when disabled
{:opacity tab-background-opacity}))))

View File

@ -55,6 +55,7 @@
id
on-press
override-theme
segmented?
size
notification-dot?]
:or {size 32}}
@ -80,6 +81,7 @@
[rn/view
{:style (style/tab {:size size
:disabled disabled
:segmented? segmented?
:background-color background-color
:show-notification-dot? show-notification-dot?})}
(when before