fix(onboarding): Can't create profile (#21170)

* Remove unnecessary React.Fragment and reagent functional components notation

* Fix continue button not responding in the Create Profile screen
This commit is contained in:
Ulises Manuel 2024-09-09 14:43:36 -06:00 committed by GitHub
parent 8f94332d59
commit fa4ea0640d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 26 deletions

View File

@ -200,13 +200,13 @@
(.remove keyboard-hide-listener)))) (.remove keyboard-hide-listener))))
(defn screen (defn screen
[{:keys [initial-insets title keypair navigation-icon recovering-keypair? render-controls]}] [{:keys [title keypair navigation-icon recovering-keypair? render-controls]}]
(let [{navigation-bar-top :top} initial-insets (let [[insets _] (rn/use-state (safe-area/get-insets))
banner-offset (rf/sub [:alert-banners/top-margin])] banner-offset (rf/sub [:alert-banners/top-margin])]
[rn/view {:style style/full-layout} [rn/view {:style style/full-layout}
[rn/keyboard-avoiding-view {:style style/page-container} [rn/keyboard-avoiding-view {:style style/page-container}
[quo/page-nav [quo/page-nav
{:margin-top navigation-bar-top {:margin-top (:top insets)
:background :blur :background :blur
:icon-name (or navigation-icon :icon-name (or navigation-icon
(if recovering-keypair? :i/close :i/arrow-left)) (if recovering-keypair? :i/close :i/arrow-left))
@ -216,15 +216,14 @@
:keypair keypair :keypair keypair
:render-controls render-controls :render-controls render-controls
:banner-offset banner-offset :banner-offset banner-offset
:initial-insets initial-insets :initial-insets insets
:recovering-keypair? recovering-keypair?}]]])) :recovering-keypair? recovering-keypair?}]]]))
(defn view (defn view
[] []
(let [insets (safe-area/get-insets)]
(fn []
(let [{:keys [recovering-keypair?]} (rf/sub [:get-screen-params])] (let [{:keys [recovering-keypair?]} (rf/sub [:get-screen-params])]
(rn/use-unmount
#(rf/dispatch [:onboarding/clear-navigated-to-enter-seed-phrase-from-screen]))
[screen [screen
{:title (i18n/label :t/use-recovery-phrase) {:title (i18n/label :t/use-recovery-phrase)
:initial-insets insets :recovering-keypair? recovering-keypair?}]))
:recovering-keypair? recovering-keypair?}]))))

View File

@ -59,7 +59,7 @@
[rn/view {:style (style/view-button-container false)} [rn/view {:style (style/view-button-container false)}
children])])) children])]))
(defn- f-page (defn- page
[{:keys [onboarding-profile-data navigation-bar-top]}] [{:keys [onboarding-profile-data navigation-bar-top]}]
(reagent/with-let [show-keyboard? (reagent/atom false) (reagent/with-let [show-keyboard? (reagent/atom false)
content-scroll-y (reagent/atom 0) content-scroll-y (reagent/atom 0)
@ -205,7 +205,6 @@
[] []
(let [{:keys [top]} (safe-area/get-insets) (let [{:keys [top]} (safe-area/get-insets)
onboarding-profile-data (rf/sub [:onboarding/profile])] onboarding-profile-data (rf/sub [:onboarding/profile])]
[:<> [page
[:f> f-page
{:navigation-bar-top top {:navigation-bar-top top
:onboarding-profile-data onboarding-profile-data}]])) :onboarding-profile-data onboarding-profile-data}]))

View File

@ -10,15 +10,16 @@
[utils.re-frame :as rf] [utils.re-frame :as rf]
[utils.security.core :as security])) [utils.security.core :as security]))
(rf/defn profile-data-set (rf/reg-event-fx
{:events [:onboarding/profile-data-set]} :onboarding/profile-data-set
[{:keys [db]} onboarding-data] (fn [{:keys [db]} [onboarding-data]]
{:db (update db :onboarding/profile merge onboarding-data) (let [navigate-from-screen (get db
:dispatch [:navigate-to-within-stack
[:screen/onboarding.create-profile-password
(get db
:onboarding/navigated-to-enter-seed-phrase-from-screen :onboarding/navigated-to-enter-seed-phrase-from-screen
:screen/onboarding.new-to-status)]]}) :screen/onboarding.new-to-status)]
{:db (update db :onboarding/profile merge onboarding-data)
:fx [[:dispatch
[:navigate-to-within-stack
[:screen/onboarding.create-profile-password navigate-from-screen]]]]})))
(rf/defn enable-biometrics (rf/defn enable-biometrics
{:events [:onboarding/enable-biometrics]} {:events [:onboarding/enable-biometrics]}
@ -33,6 +34,11 @@
{:db (assoc db :onboarding/navigated-to-enter-seed-phrase-from-screen from-screen) {:db (assoc db :onboarding/navigated-to-enter-seed-phrase-from-screen from-screen)
:fx [[:dispatch [:navigate-to-within-stack [:screen/onboarding.enter-seed-phrase from-screen]]]]})) :fx [[:dispatch [:navigate-to-within-stack [:screen/onboarding.enter-seed-phrase from-screen]]]]}))
(rf/reg-event-fx
:onboarding/clear-navigated-to-enter-seed-phrase-from-screen
(fn [{:keys [db]}]
{:db (dissoc db :onboarding/navigated-to-enter-seed-phrase-from-screen)}))
(rf/reg-event-fx :onboarding/navigate-to-enable-notifications-from-syncing (rf/reg-event-fx :onboarding/navigate-to-enable-notifications-from-syncing
(fn [{:keys [db]}] (fn [{:keys [db]}]
{:db (dissoc db :onboarding/profile) {:db (dissoc db :onboarding/profile)