diff --git a/src/status_im/ui/components/camera.cljs b/src/status_im/ui/components/camera.cljs index 7eb7c5ac5c..c95c93616e 100644 --- a/src/status_im/ui/components/camera.cljs +++ b/src/status_im/ui/components/camera.cljs @@ -1,6 +1,7 @@ (ns status-im.ui.components.camera (:require [goog.object :as object] [reagent.core :as reagent] + [clojure.string :as string] [clojure.walk :as walk] [status-im.react-native.js-dependencies :as js-dependencies] [status-im.utils.platform :as platform])) @@ -34,4 +35,5 @@ (reagent/create-element default-camera (clj->js (merge {:inverted true} props)))) (defn get-qr-code-data [code] - (.-data code)) + (when-let [data (.-data code)] + (string/trim data))) diff --git a/src/status_im/ui/screens/qr_scanner/views.cljs b/src/status_im/ui/screens/qr_scanner/views.cljs index 1783ef8837..57da776de2 100644 --- a/src/status_im/ui/screens/qr_scanner/views.cljs +++ b/src/status_im/ui/screens/qr_scanner/views.cljs @@ -1,6 +1,7 @@ (ns status-im.ui.screens.qr-scanner.views (:require-macros [status-im.utils.views :refer [defview letsubs]]) (:require [re-frame.core :as re-frame] + [clojure.string :as string] [status-im.i18n :as i18n] [status-im.ui.components.camera :as camera] [status-im.ui.components.react :as react] @@ -42,7 +43,7 @@ :on-press #(re-frame/dispatch [:qr-scanner.callback/scan-qr-code-cancel opts])}] [button/button {:label "OK" - :on-press #(re-frame/dispatch [:qr-scanner.callback/scan-qr-code-success opts @text-value])}]]]])) + :on-press #(re-frame/dispatch [:qr-scanner.callback/scan-qr-code-success opts (when-let [text @text-value] (string/trim text))])}]]]])) (defn corner [border1 border2 corner] [react/view (assoc {:border-color colors/white-persist :width 60 :height 60} border1 5 border2 5 corner 32)])