mirror of
https://github.com/status-im/status-react.git
synced 2025-02-03 14:46:05 +00:00
update scan qr code page
* update scan qr code page * update scan qr code page * fixed: populate the search input with new identity * dismiss keyboard when scan qr page is activated
This commit is contained in:
parent
489557c1a3
commit
64de325678
@ -38,10 +38,11 @@
|
|||||||
:padding-horizontal screen-padding
|
:padding-horizontal screen-padding
|
||||||
:margin-vertical 12})
|
:margin-vertical 12})
|
||||||
|
|
||||||
(def header-text
|
(defn header-text
|
||||||
|
[bottom-padding?]
|
||||||
{:padding-horizontal screen-padding
|
{:padding-horizontal screen-padding
|
||||||
:padding-top 12
|
:padding-top 12
|
||||||
:padding-bottom 8
|
:padding-bottom (when bottom-padding? 8)
|
||||||
:color colors/white})
|
:color colors/white})
|
||||||
|
|
||||||
(def header-sub-text
|
(def header-sub-text
|
||||||
@ -53,7 +54,7 @@
|
|||||||
:margin-top 20})
|
:margin-top 20})
|
||||||
|
|
||||||
(def scan-qr-code-container
|
(def scan-qr-code-container
|
||||||
{:margin-top 19})
|
{:margin-top 20})
|
||||||
|
|
||||||
(def qr-view-finder
|
(def qr-view-finder
|
||||||
{:margin-horizontal screen-padding
|
{:margin-horizontal screen-padding
|
||||||
|
@ -35,13 +35,14 @@
|
|||||||
[quo/text
|
[quo/text
|
||||||
{:size :heading-1
|
{:size :heading-1
|
||||||
:weight :semi-bold
|
:weight :semi-bold
|
||||||
:style style/header-text}
|
:style (style/header-text (when subtitle true))}
|
||||||
title]
|
title]
|
||||||
[quo/text
|
(when subtitle
|
||||||
{:size :paragraph-1
|
[quo/text
|
||||||
:weight :regular
|
{:size :paragraph-1
|
||||||
:style style/header-sub-text}
|
:weight :regular
|
||||||
subtitle]])
|
:style style/header-sub-text}
|
||||||
|
subtitle])])
|
||||||
|
|
||||||
(defn get-labels-and-on-press-method
|
(defn get-labels-and-on-press-method
|
||||||
[]
|
[]
|
||||||
@ -109,21 +110,22 @@
|
|||||||
[white-border :bottom-right]]])
|
[white-border :bottom-right]]])
|
||||||
|
|
||||||
(defn- viewfinder
|
(defn- viewfinder
|
||||||
[qr-view-finder]
|
[qr-view-finder helper-text?]
|
||||||
(let [layout-size (+ (:width qr-view-finder) 2)]
|
(let [layout-size (+ (:width qr-view-finder) 2)]
|
||||||
[rn/view {:style (style/viewfinder-container qr-view-finder)}
|
[rn/view {:style (style/viewfinder-container qr-view-finder)}
|
||||||
[white-square layout-size]
|
[white-square layout-size]
|
||||||
[quo/text
|
(when helper-text?
|
||||||
{:size :paragraph-2
|
[quo/text
|
||||||
:weight :regular
|
{:size :paragraph-2
|
||||||
:style style/viewfinder-text}
|
:weight :regular
|
||||||
(i18n/label :t/ensure-qr-code-is-in-focus-to-scan)]]))
|
:style style/viewfinder-text}
|
||||||
|
(i18n/label :t/ensure-qr-code-is-in-focus-to-scan)])]))
|
||||||
|
|
||||||
(defn- scan-qr-code-tab
|
(defn- scan-qr-code-tab
|
||||||
[qr-view-finder]
|
[qr-view-finder helper-text?]
|
||||||
(if (and @camera-permission-granted?
|
(if (and @camera-permission-granted?
|
||||||
(boolean (not-empty qr-view-finder)))
|
(boolean (not-empty qr-view-finder)))
|
||||||
[viewfinder qr-view-finder]
|
[viewfinder qr-view-finder helper-text?]
|
||||||
[camera-permission-view]))
|
[camera-permission-view]))
|
||||||
|
|
||||||
(defn- check-qr-code-and-navigate
|
(defn- check-qr-code-and-navigate
|
||||||
@ -223,7 +225,7 @@
|
|||||||
[:<>
|
[:<>
|
||||||
[rn/view {:style style/scan-qr-code-container}]
|
[rn/view {:style style/scan-qr-code-container}]
|
||||||
[qr-scan-hole-area qr-view-finder]])
|
[qr-scan-hole-area qr-view-finder]])
|
||||||
[scan-qr-code-tab @qr-view-finder]
|
[scan-qr-code-tab @qr-view-finder (when subtitle true)]
|
||||||
[rn/view {:style style/flex-spacer}]
|
[rn/view {:style style/flex-spacer}]
|
||||||
(when show-camera?
|
(when show-camera?
|
||||||
[quo.theme/provider {:theme :light}
|
[quo.theme/provider {:theme :light}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
(ns status-im2.contexts.add-new-contact.scan.scan-profile-qr-page
|
||||||
|
(:require [react-native.core :as rn]
|
||||||
|
[react-native.hooks :as hooks]
|
||||||
|
[status-im2.common.scan-qr-code.view :as scan-qr-code]
|
||||||
|
[utils.debounce :as debounce]
|
||||||
|
[utils.i18n :as i18n]))
|
||||||
|
|
||||||
|
(defn- f-internal-view
|
||||||
|
[]
|
||||||
|
(let [{:keys [keyboard-shown]} (hooks/use-keyboard)]
|
||||||
|
[:<>
|
||||||
|
(when keyboard-shown
|
||||||
|
(rn/dismiss-keyboard!))
|
||||||
|
[scan-qr-code/view
|
||||||
|
{:title (i18n/label :t/scan-qr)
|
||||||
|
:on-success-scan #(debounce/debounce-and-dispatch [:contacts/set-new-identity % %] 300)}]]))
|
||||||
|
|
||||||
|
(defn view
|
||||||
|
[]
|
||||||
|
[:f> f-internal-view])
|
@ -4,7 +4,6 @@
|
|||||||
[react-native.clipboard :as clipboard]
|
[react-native.clipboard :as clipboard]
|
||||||
[react-native.core :as rn]
|
[react-native.core :as rn]
|
||||||
[reagent.core :as reagent]
|
[reagent.core :as reagent]
|
||||||
[status-im.qr-scanner.core :as qr-scanner]
|
|
||||||
[status-im2.contexts.add-new-contact.style :as style]
|
[status-im2.contexts.add-new-contact.style :as style]
|
||||||
[utils.address :as address]
|
[utils.address :as address]
|
||||||
[utils.debounce :as debounce]
|
[utils.debounce :as debounce]
|
||||||
@ -96,8 +95,7 @@
|
|||||||
{:type :outline
|
{:type :outline
|
||||||
:icon-only? true
|
:icon-only? true
|
||||||
:size 40
|
:size 40
|
||||||
:on-press #(rf/dispatch [::qr-scanner/scan-code
|
:on-press #(rf/dispatch [:open-modal :scan-profile-qr-code])}
|
||||||
{:handler :contacts/qr-code-scanned}])}
|
|
||||||
:i/scan]]])
|
:i/scan]]])
|
||||||
(finally
|
(finally
|
||||||
(rf/dispatch [:contacts/clear-new-identity]))))
|
(rf/dispatch [:contacts/clear-new-identity]))))
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
(:require
|
(:require
|
||||||
[status-im.ui.screens.screens :as old-screens]
|
[status-im.ui.screens.screens :as old-screens]
|
||||||
[status-im2.config :as config]
|
[status-im2.config :as config]
|
||||||
|
[status-im2.contexts.add-new-contact.scan.scan-profile-qr-page :as scan-profile-qr-page]
|
||||||
[status-im2.contexts.add-new-contact.views :as add-new-contact]
|
[status-im2.contexts.add-new-contact.views :as add-new-contact]
|
||||||
[status-im2.contexts.chat.camera.view :as camera-screen]
|
[status-im2.contexts.chat.camera.view :as camera-screen]
|
||||||
[status-im2.contexts.chat.group-details.view :as group-details]
|
[status-im2.contexts.chat.group-details.view :as group-details]
|
||||||
@ -315,7 +316,13 @@
|
|||||||
:options (merge
|
:options (merge
|
||||||
options/dark-screen
|
options/dark-screen
|
||||||
{:modalPresentationStyle :overCurrentContext})
|
{:modalPresentationStyle :overCurrentContext})
|
||||||
:component scan-address/view}]
|
:component scan-address/view}
|
||||||
|
|
||||||
|
{:name :scan-profile-qr-code
|
||||||
|
:options (merge
|
||||||
|
options/dark-screen
|
||||||
|
{:modalPresentationStyle :overCurrentContext})
|
||||||
|
:component scan-profile-qr-page/view}]
|
||||||
|
|
||||||
(when js/goog.DEBUG
|
(when js/goog.DEBUG
|
||||||
[{:name :dev-component-preview
|
[{:name :dev-component-preview
|
||||||
|
Loading…
x
Reference in New Issue
Block a user