Compare commits

...
3 changed files with 20 additions and 5 deletions
@@ -35,6 +35,7 @@
size 40
customization-color (if (= type :primary) :blue nil)}}
children]
(when (string? children) (js/console.log "button - " children))
(let [[pressed-state? set-pressed-state] (rn/use-state false)
theme (theme/use-theme-value)
{:keys [icon-color background-color label-color border-color blur-type
+2 -2
View File
@@ -14,11 +14,11 @@
[{:keys [on-press allow-multiple-presses? throttle-duration]} throttle-id]
(if allow-multiple-presses?
on-press
(fn []
(fn [event]
(let [id @throttle-id]
(when (and id (not (get @throttle id)))
(swap! throttle assoc id true)
(on-press)
(on-press event)
(js/setTimeout
#(swap! throttle dissoc id)
(or throttle-duration 500)))))))
@@ -2,12 +2,17 @@
(:require [clojure.string :as string]
[quo.core :as quo]
[react-native.core :as rn]
[reagent.ratom]
[status-im.constants :as constants]
[status-im.contexts.profile.contact.contact-request.style :as style]
[status-im.contexts.profile.utils :as profile.utils]
[utils.i18n :as i18n]
[utils.re-frame :as rf]))
(defn example-component [props]
(js/console.log "example component render" (clj->js props))
[rn/text "Hello"])
(defn view
[]
(let [{:keys [public-key customization-color]
@@ -17,7 +22,9 @@
full-name (profile.utils/displayed-name profile)
profile-picture (profile.utils/photo profile)
[message set-message] (rn/use-state "")
on-message-change (rn/use-callback #(set-message %))
on-message-change (rn/use-callback #(do
(set-message %)))
on-press-test (rn/use-callback #(rf/dispatch [:contacts/update-nickname public-key "Example nickname"]))
on-message-submit (rn/use-callback (fn []
(rf/dispatch [:hide-bottom-sheet])
(rf/dispatch [:contact.ui/send-contact-request
@@ -28,7 +35,10 @@
:text (i18n/label
:t/contact-request-was-sent)}]))
[public-key message])]
(js/console.log "contact request view render")
[:<>
[quo/button {} "Example static button"]
[example-component {:on-test on-press-test}]
[quo/drawer-top
{:type :context-tag
:context-tag-type :default
@@ -50,10 +60,14 @@
:label (i18n/label :t/message)
:on-change-text on-message-change}]]
[quo/bottom-actions
{:actions :one-action
{:actions :two-actions
:button-one-props {:disabled? (string/blank? message)
:accessibility-label :send-contact-request
:customization-color customization-color
:on-press on-message-submit}
:button-one-label (i18n/label :t/send-contact-request)}]]))
:button-one-label "Test Button One"
:button-two-props {:accessibility-label :test-button
:customization-color :danger
:on-press on-press-test}
:button-two-label "Test Button Two"}]]))