Fix Metro Warnings ⚠️ (#14389)

* fix: metro warnings ⚠️
This commit is contained in:
Omar Basem 2022-11-17 21:19:54 +04:00 committed by GitHub
parent 84da3128bf
commit 73bbfa7d31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 124 additions and 93 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -126,10 +126,8 @@
:height outer-dimensions
:border-radius outer-dimensions}}
(when (and ring? identicon?)
[icons/icon :main-icons/identicon-ring {:width outer-dimensions
:height outer-dimensions
:size outer-dimensions
:no-color true}])
[icons/icon :i/identicon-ring {:size outer-dimensions
:no-color true}])
(if profile-picture
;; display image
[fast-image/fast-image {:source {:uri profile-picture}

View File

@ -9,54 +9,6 @@
(colors/theme-colors colors/danger-50 colors/danger-60)
(colors/theme-colors colors/neutral-50 colors/neutral-40)))
(defn action [{:keys [icon
label
sub-label
right-icon
danger?
on-press] :as action-props}]
(when action-props
[rn/touchable-opacity {:on-press on-press}
[rn/view {:style
{:height (if sub-label 56 47)
:margin-horizontal 20
:flex-direction :row}}
[rn/view {:style
{:height 20
:margin-top :auto
:margin-bottom :auto
:margin-right 12
:width 20}}
[icon/icon icon
{:color (get-icon-color danger?)
:size 20}]]
[rn/view
{:style
{:flex 1
:justify-content :center}}
[text/text
{:size :paragraph-1
:weight :medium
:style {:color
(when danger?
(colors/theme-colors colors/danger-50 colors/danger-60))}}
label]
(when sub-label
[text/text
{:size :paragraph-2
:style {:color
(colors/theme-colors colors/neutral-50 colors/neutral-40)}}
sub-label])]
(when right-icon
[rn/view {:style
{:height 20
:margin-top :auto
:margin-bottom :auto
:width 20}}
[icon/icon right-icon
{:color (get-icon-color danger?)
:size 20}]])]]))
(defn divider []
[rn/view {:style {:border-top-width 1
:border-top-color (colors/theme-colors colors/neutral-10 colors/neutral-80)
@ -65,10 +17,60 @@
:align-items :center
:flex-direction :row}}])
(defn action [{:keys [icon
label
sub-label
right-icon
danger?
on-press
add-divider?] :as action-props}]
(when action-props
[:<> {:key label}
(when add-divider? [divider])
[rn/touchable-opacity {:on-press on-press}
[rn/view {:style
{:height (if sub-label 56 47)
:margin-horizontal 20
:flex-direction :row}}
[rn/view {:style
{:height 20
:margin-top :auto
:margin-bottom :auto
:margin-right 12
:width 20}}
[icon/icon icon
{:color (get-icon-color danger?)
:size 20}]]
[rn/view
{:style
{:flex 1
:justify-content :center}}
[text/text
{:size :paragraph-1
:weight :medium
:style {:color
(when danger?
(colors/theme-colors colors/danger-50 colors/danger-60))}}
label]
(when sub-label
[text/text
{:size :paragraph-2
:style {:color
(colors/theme-colors colors/neutral-50 colors/neutral-40)}}
sub-label])]
(when right-icon
[rn/view {:style
{:height 20
:margin-top :auto
:margin-bottom :auto
:width 20}}
[icon/icon right-icon
{:color (get-icon-color danger?)
:size 20}]])]]]))
(defn action-drawer [sections]
[:<> {:style
{:flex 1}}
(interpose
[divider]
[:<>
(doall
(for [actions sections]
(map action actions)))])
(doall
(map action actions))))])

View File

@ -30,4 +30,5 @@
(get-icons 12)
(get-icons 16)
(get-icons 20)
(get-icons 24)))
(get-icons 24)
(get-icons 32)))

View File

@ -27,6 +27,9 @@
(defn show-overlay [comp]
(.showOverlay Navigation (clj->js comp)))
(defn pop-to-root [tab]
(.popToRoot Navigation (clj->js tab)))
(defn dissmiss-overlay [comp]
(.catch (.dismissOverlay Navigation comp) #()))

View File

@ -8,18 +8,19 @@
[status-im.constants :as constants]
[quo2.components.drawers.action-drawers :as drawer]))
(defn- entry [{:keys [icon label on-press danger? sub-label chevron?]}]
(defn- entry [{:keys [icon label on-press danger? sub-label chevron? add-divider?]}]
{:pre [(keyword? icon)
(string? label)
(fn? on-press)
(boolean? danger?)
(boolean? chevron?)]}
{:icon icon
:label label
:on-press on-press
:danger? danger?
:sub-label sub-label
:right-icon (when chevron? :i/chevron-right)})
{:icon icon
:label label
:on-press on-press
:danger? danger?
:sub-label sub-label
:right-icon (when chevron? :i/chevron-right)
:add-divider? add-divider?})
(defn hide-sheet-and-dispatch [event]
(rf/dispatch [:bottom-sheet/hide])
@ -91,20 +92,22 @@
:chevron? true})))
(defn mark-as-read-entry [chat-id]
(entry {:icon :i/correct
:label (i18n/label :t/mark-as-read)
:on-press #(mark-all-read-action chat-id)
:danger? false
:sub-label nil
:chevron? false}))
(entry {:icon :i/correct
:label (i18n/label :t/mark-as-read)
:on-press #(mark-all-read-action chat-id)
:danger? false
:sub-label nil
:chevron? false
:add-divider? true}))
(defn clear-history-entry [chat-id]
(entry {:icon :i/delete
:label (i18n/label :t/clear-history)
:on-press #(clear-history-action chat-id)
:danger? true
:sub-label nil
:chevron? false}))
(entry {:icon :i/delete
:label (i18n/label :t/clear-history)
:on-press #(clear-history-action chat-id)
:danger? true
:sub-label nil
:chevron? false
:add-divider? true}))
(defn delete-chat-entry [item]
(entry {:icon :i/delete
@ -203,12 +206,13 @@
:chevron? false}))
(defn mark-untrustworthy-entry []
(entry {:icon :i/alert
:label (i18n/label :t/mark-untrustworthy)
:on-press #(js/alert "TODO: to be implemented, requires status-go impl.")
:danger? true
:sub-label nil
:chevron? false}))
(entry {:icon :i/alert
:label (i18n/label :t/mark-untrustworthy)
:on-press #(js/alert "TODO: to be implemented, requires status-go impl.")
:danger? true
:sub-label nil
:chevron? false
:add-divider? true}))
(defn block-user-entry [item]
(entry {:icon :i/block

View File

@ -91,9 +91,9 @@
(if group-chat
[quo2/group-avatar {:color color
:size :medium}]
[quo2/user-avatar {:full-name display-name
:profile-picture photo-path
:size :small}]))
[quo2/user-avatar {:full-name display-name
:profile-picture photo-path
:size :small}]))
(defn messages-home-item [item]
(let [{:keys [chat-id

View File

@ -68,11 +68,11 @@
:size :label
:weight :regular
:accessibility-label :quoted-message
:ellipsize-mode :tail
:style (merge
{:ellipsize-mode :tail
:text-transform :none
:margin-left 4
:margin-top 2}
{:text-transform :none
:margin-left 4
:margin-top 2}
(when (or (= constants/content-type-image content-type)
(= constants/content-type-sticker content-type)
(= constants/content-type-audio content-type))

View File

@ -195,7 +195,7 @@
{:id :sent
:label (i18n/label :t/sent)}]}]
[list/flat-list
{:key-fn :first
{:key-fn :chat-id
:data (if (= @selected-requests-tab :received) received-requests sent-requests)
:render-fn received-cr-item/received-cr-item}]]))])

View File

@ -325,3 +325,8 @@
:change-root-status-bar-style-fx
(fn [style]
(navigation/merge-options "shell-stack" {:statusBar {:style style}})))
(re-frame/reg-fx
:pop-to-root-tab-fx
(fn [tab]
(navigation/pop-to-root tab)))

View File

@ -40,7 +40,8 @@
(rf/defn change-tab
{:events [:navigate-change-tab]}
[_ tab]
{:change-tab-fx tab})
;{:change-tab-fx tab} ; TODO: effect needs to be implemented (may not be possible: https://github.com/wix/react-native-navigation/issues/4837)
)
(rf/defn navigate-replace
{:events [:navigate-replace]}

View File

@ -4,7 +4,24 @@
[status-im.ethereum.json-rpc :as json-rpc]
["react-native" :refer (DevSettings LogBox)]))
(.ignoreAllLogs LogBox)
;; Only ignore warnings/errors that cannot be fixed for the time being.
;; When you add a warning to be ignored explain below why it is ignored and how it can be fixed.
;; When a warning is fixed make sure to remove it from here.
(.ignoreLogs ^js LogBox (clj->js ["undefined is not an object (evaluating 'e.message')"
"Cannot read property 'message' of undefined"
"InternalError Metro has encountered an error"
"undefined Unable to resolve module `parse-svg-path`"
"group12"]))
;; List of ignored warnings/errors:
;; 1. "evaluating 'e.message'": Not sure why this error is happening, but it is coming from here
;; @walletconnect/jsonrpc-utils/dist/esm/error.js parseConnectionError() method
;; 2. "Cannot read property 'message' of undefined": same as 1, but for Android
;; 3. "InternalError Metro has encountered an error": an error that happens when losing connection to metro, can be safely ignored
;; 4. "undefined Unable to resolve module `parse-svg-path`": an error that happens when losing connection to metro, can be safely ignored
;; 5. "group12": referring to the group-icon size 12x12. Currently, it is not available. When the design team adds it to the
;; icon set it will be added to project.
(defn setup []
(rf/set-mergeable-keys #{:filters/load-filters