Skip to content

Commit 427cd22

Browse files
committed
(fix) modify disclaimer component for on tap UX
1 parent 9a8354f commit 427cd22

File tree

3 files changed

+20
-22
lines changed

3 files changed

+20
-22
lines changed

src/quo2/components/selectors/disclaimer/component_spec.cljs

-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212
(h/render [disclaimer/view {} text])
1313
(h/is-truthy (h/get-by-text text))))
1414

15-
(h/test "On change event gets fire after press"
16-
(let [mock-fn (h/mock-fn)]
17-
(h/render [disclaimer/view {:on-change mock-fn} "test"])
18-
(h/fire-event :press (h/get-by-label-text :checkbox-off))
19-
(h/was-called mock-fn)))
20-
2115
(h/describe "It's rendered according to its `checked?` property"
2216
(h/test "checked? true"
2317
(h/render [disclaimer/view {:checked? true} "test"])

src/quo2/components/selectors/disclaimer/view.cljs

+18-13
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,23 @@
22
(:require [quo2.components.markdown.text :as text]
33
[quo2.components.selectors.disclaimer.style :as style]
44
[quo2.components.selectors.selectors.view :as selectors]
5-
[react-native.core :as rn]))
5+
[react-native.core :as rn]
6+
[reagent.core :as reagent]))
67

78
(defn view
8-
[{:keys [checked? blur? on-change accessibility-label container-style]} label]
9-
[rn/view
10-
{:style (merge container-style (style/container blur?))}
11-
[selectors/checkbox
12-
{:accessibility-label accessibility-label
13-
:blur? blur?
14-
:checked? checked?
15-
:on-change on-change}]
16-
[text/text
17-
{:size :paragraph-2
18-
:style style/text}
19-
label]])
9+
[{:keys [checked? blur? accessibility-label container-style]} label]
10+
(let [checked-state? (reagent/atom (or checked? false))]
11+
(fn []
12+
[rn/touchable-opacity
13+
{:on-press #(swap! checked-state? not)
14+
:accessibility-label "disclaimer-touchable-opacity"}
15+
[rn/view {:style (merge container-style (style/container blur?))}
16+
[selectors/checkbox
17+
{:accessibility-label accessibility-label
18+
:blur? blur?
19+
:checked? @checked-state?
20+
:on-change #(swap! checked-state? not)}]
21+
[text/text
22+
{:size :paragraph-2
23+
:style style/text}
24+
label]]])))

src/status_im2/contexts/onboarding/create_password/view.cljs

+2-3
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@
165165
[rn/view {:style style/bottom-part}
166166
[rn/view {:style style/disclaimer-container}
167167
[quo/disclaimer
168-
{:blur? true
169-
:on-change #(reset! accepts-disclaimer? %)
170-
:checked? @accepts-disclaimer?}
168+
{:blur? true
169+
:checked? @accepts-disclaimer?}
171170
(i18n/label :t/password-creation-disclaimer)]]
172171

173172
(when (= @focused-input :password)

0 commit comments

Comments
 (0)