[FIX #3379] Support platform specific :uppercase? as a text prop
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
8c6dde8e06
commit
c8e88a74b4
|
@ -16,7 +16,6 @@
|
||||||
:chats {:action-button? true
|
:chats {:action-button? true
|
||||||
:new-chat-in-toolbar? false
|
:new-chat-in-toolbar? false
|
||||||
:render-separator? false}
|
:render-separator? false}
|
||||||
:uppercase? true
|
|
||||||
:contacts {:action-button? true
|
:contacts {:action-button? true
|
||||||
:new-contact-in-toolbar? false}
|
:new-contact-in-toolbar? false}
|
||||||
:group-block-shadows? true
|
:group-block-shadows? true
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
:chats {:action-button? false
|
:chats {:action-button? false
|
||||||
:new-chat-in-toolbar? true
|
:new-chat-in-toolbar? true
|
||||||
:render-separator? true}
|
:render-separator? true}
|
||||||
:uppercase? false
|
|
||||||
:contacts {:action-button? false
|
:contacts {:action-button? false
|
||||||
:new-contact-in-toolbar? true}
|
:new-contact-in-toolbar? true}
|
||||||
:group-block-shadows? false
|
:group-block-shadows? false
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
(when disabled?
|
(when disabled?
|
||||||
{:opacity 0.4}))
|
{:opacity 0.4}))
|
||||||
:font (if platform/android? :medium :default)
|
:font (if platform/android? :medium :default)
|
||||||
:uppercase? (get-in platform/platform-specific [:uppercase?])}
|
:uppercase? true}
|
||||||
label]
|
label]
|
||||||
icon]])
|
icon]])
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
[react/touchable-highlight {:on-press on-press :disabled disabled?}
|
[react/touchable-highlight {:on-press on-press :disabled disabled?}
|
||||||
[react/view (styles/bottom-button disabled?)
|
[react/view (styles/bottom-button disabled?)
|
||||||
[react/text {:style styles/bottom-button-label
|
[react/text {:style styles/bottom-button-label
|
||||||
:uppercase? platform/android?}
|
:uppercase? true}
|
||||||
(or label (i18n/label :t/next))]
|
(or label (i18n/label :t/next))]
|
||||||
(when forward?
|
(when forward?
|
||||||
[icons/icon :icons/forward {:color colors/blue}])]])
|
[icons/icon :icons/forward {:color colors/blue}])]])
|
||||||
|
@ -84,6 +84,7 @@
|
||||||
(defn button [{:keys [on-press label background? style] :or {background? true}}]
|
(defn button [{:keys [on-press label background? style] :or {background? true}}]
|
||||||
[react/touchable-highlight {:on-press on-press}
|
[react/touchable-highlight {:on-press on-press}
|
||||||
[react/view {:style (styles/button style background?)}
|
[react/view {:style (styles/button style background?)}
|
||||||
[react/text {:uppercase? platform/android?
|
[react/text {:uppercase? true
|
||||||
:style styles/button-label}
|
:style styles/button-label}
|
||||||
label]]])
|
label]]])
|
||||||
|
|
||||||
|
|
|
@ -78,17 +78,20 @@
|
||||||
(dissoc :font)
|
(dissoc :font)
|
||||||
(assoc style-key (merge style font)))))
|
(assoc style-key (merge style font)))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn transform-to-uppercase [{:keys [uppercase? force-uppercase?] :as opts} ts]
|
||||||
|
(if (or force-uppercase? (and uppercase? platform/android?))
|
||||||
|
(vec (map string/upper-case ts))
|
||||||
|
ts))
|
||||||
|
|
||||||
(defn text
|
(defn text
|
||||||
([t]
|
([t]
|
||||||
(reagent/as-element [text-class t]))
|
[text-class t])
|
||||||
([{:keys [uppercase?] :as opts} t & ts]
|
([opts t & ts]
|
||||||
(reagent/as-element
|
(->> (conj ts t)
|
||||||
(let [ts (cond->> (conj ts t)
|
(transform-to-uppercase opts)
|
||||||
uppercase? (map #(when % (string/upper-case %))))]
|
(concat [text-class (add-font-style :style opts)])
|
||||||
(vec (concat
|
(vec))))
|
||||||
[text-class (add-font-style :style opts)]
|
|
||||||
ts))))))
|
|
||||||
|
|
||||||
|
|
||||||
(defn text-input [{:keys [font style] :as opts
|
(defn text-input [{:keys [font style] :as opts
|
||||||
:or {font :default}} text]
|
:or {font :default}} text]
|
||||||
|
|
|
@ -25,6 +25,6 @@
|
||||||
([label on-press once?]
|
([label on-press once?]
|
||||||
[react/touchable-highlight {:on-press (if once? (u/wrap-call-once! on-press) on-press)}
|
[react/touchable-highlight {:on-press (if once? (u/wrap-call-once! on-press) on-press)}
|
||||||
[react/view sticky-button-style
|
[react/view sticky-button-style
|
||||||
[react/text {:style sticky-button-label-style
|
[react/text {:style sticky-button-label-style
|
||||||
:uppercase? (get-in platform/platform-specific [:uppercase?])}
|
:uppercase? true}
|
||||||
label]]]))
|
label]]]))
|
||||||
|
|
|
@ -155,10 +155,3 @@
|
||||||
:flex 1})
|
:flex 1})
|
||||||
|
|
||||||
(def border-radius 8)
|
(def border-radius 8)
|
||||||
|
|
||||||
;; TODO(goranjovic): replace all platform conditional uppercase styling with a reference to this var
|
|
||||||
(def uppercase?
|
|
||||||
(condp = platform/platform
|
|
||||||
"android" true
|
|
||||||
"ios" false
|
|
||||||
false))
|
|
||||||
|
|
|
@ -76,7 +76,7 @@
|
||||||
[react/text (cond-> {:style (merge styles/item styles/item-text style
|
[react/text (cond-> {:style (merge styles/item styles/item-text style
|
||||||
(when disabled? styles/toolbar-text-action-disabled))
|
(when disabled? styles/toolbar-text-action-disabled))
|
||||||
:on-press (when-not disabled? handler)
|
:on-press (when-not disabled? handler)
|
||||||
:uppercase? components.styles/uppercase?}
|
:uppercase? true}
|
||||||
accessibility-label
|
accessibility-label
|
||||||
(assoc :accessibility-label accessibility-label))
|
(assoc :accessibility-label accessibility-label))
|
||||||
title])
|
title])
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
;; NOTE(oskarth): text-transform to uppercase not supported as RN style
|
;; NOTE(oskarth): text-transform to uppercase not supported as RN style
|
||||||
;; https://github.com/facebook/react-native/issues/2088
|
;; https://github.com/facebook/react-native/issues/2088
|
||||||
[react/text {:style (styles/title-action-text active?)
|
[react/text {:style (styles/title-action-text active?)
|
||||||
:uppercase? (:uppercase? styles/subtitle-text-augment)}
|
:uppercase? true}
|
||||||
(i18n/label action-kw)]]]])
|
(i18n/label action-kw)]]]])
|
||||||
|
|
||||||
;; TODO(oskarth): Reconcile with above fn
|
;; TODO(oskarth): Reconcile with above fn
|
||||||
|
@ -53,7 +53,8 @@
|
||||||
[react/view styles/chat-button-inner
|
[react/view styles/chat-button-inner
|
||||||
[vector-icons/icon :icons/chats {:color :active}]
|
[vector-icons/icon :icons/chats {:color :active}]
|
||||||
[react/text {:style styles/chat-button-text
|
[react/text {:style styles/chat-button-text
|
||||||
:uppercase? (:uppercase? styles/chat-button-text-case)} (i18n/label :t/chat)]]]])
|
:uppercase? true}
|
||||||
|
(i18n/label :t/chat)]]]])
|
||||||
|
|
||||||
(defn discover-list-item [{:keys [message show-separator? current-account contacts]}]
|
(defn discover-list-item [{:keys [message show-separator? current-account contacts]}]
|
||||||
(let [{contact-name :name
|
(let [{contact-name :name
|
||||||
|
|
|
@ -37,12 +37,6 @@
|
||||||
:android {:color styles/color-gray2
|
:android {:color styles/color-gray2
|
||||||
:font-size 14}})
|
:font-size 14}})
|
||||||
|
|
||||||
;; NOTE(oskarth): Hacky use of defstyle to get
|
|
||||||
;; platform specific styles in place where they belong
|
|
||||||
(defstyle subtitle-text-augment
|
|
||||||
{:ios {:uppercase? false}
|
|
||||||
:android {:uppercase? true}})
|
|
||||||
|
|
||||||
(defstyle discover-item-status-text
|
(defstyle discover-item-status-text
|
||||||
{:ios {:font-size 14
|
{:ios {:font-size 14
|
||||||
:letter-spacing -0.1}
|
:letter-spacing -0.1}
|
||||||
|
@ -156,12 +150,6 @@
|
||||||
:padding-right 8
|
:padding-right 8
|
||||||
:padding-bottom 5})
|
:padding-bottom 5})
|
||||||
|
|
||||||
;; NOTE(goranjovic): Another hacky use of defstyle to get
|
|
||||||
;; platform specific styles in place where they belong
|
|
||||||
(defstyle chat-button-text-case
|
|
||||||
{:ios {:uppercase? false}
|
|
||||||
:android {:uppercase? true}})
|
|
||||||
|
|
||||||
(defstyle chat-button-text
|
(defstyle chat-button-text
|
||||||
{:color styles/color-blue4
|
{:color styles/color-blue4
|
||||||
:ios {:font-size 15}
|
:ios {:font-size 15}
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
[react/view {:style st/connect-button
|
[react/view {:style st/connect-button
|
||||||
:accessibility-label :network-connect-button}
|
:accessibility-label :network-connect-button}
|
||||||
[react/text {:style st/connect-button-label
|
[react/text {:style st/connect-button-label
|
||||||
:uppercase? (get-in platform/platform-specific [:uppercase?])}
|
:uppercase? true}
|
||||||
(i18n/label :t/connect)]]
|
(i18n/label :t/connect)]]
|
||||||
[react/text {:style st/connect-button-description}
|
[react/text {:style st/connect-button-description}
|
||||||
(i18n/label :t/connecting-requires-login)]]])
|
(i18n/label :t/connecting-requires-login)]]])
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
[react/view st/edit-button-container
|
[react/view st/edit-button-container
|
||||||
[react/view st/edit-button
|
[react/view st/edit-button
|
||||||
[react/text {:style st/edit-button-label
|
[react/text {:style st/edit-button-label
|
||||||
:uppercase? (get-in platform/platform-specific [:uppercase?])}
|
:uppercase? true}
|
||||||
(i18n/label :t/edit-network-config)]]
|
(i18n/label :t/edit-network-config)]]
|
||||||
#_[context-menu ; TODO should be implemented later
|
#_[context-menu ; TODO should be implemented later
|
||||||
[view st/edit-button
|
[view st/edit-button
|
||||||
|
|
|
@ -77,7 +77,7 @@
|
||||||
(when-not (string/blank? value)
|
(when-not (string/blank? value)
|
||||||
[react/text {:style styles/settings-item-value
|
[react/text {:style styles/settings-item-value
|
||||||
:number-of-lines 1
|
:number-of-lines 1
|
||||||
:uppercase? components.styles/uppercase?}
|
:uppercase? true}
|
||||||
value])]
|
value])]
|
||||||
(when active?
|
(when active?
|
||||||
[vector-icons/icon :icons/forward {:color colors/gray}])]])
|
[vector-icons/icon :icons/forward {:color colors/gray}])]])
|
||||||
|
|
|
@ -23,7 +23,8 @@
|
||||||
{:on-press #(re-frame/dispatch [:group-chat-profile/start-editing])}
|
{:on-press #(re-frame/dispatch [:group-chat-profile/start-editing])}
|
||||||
[react/view
|
[react/view
|
||||||
[react/text {:style common.styles/label-action-text
|
[react/text {:style common.styles/label-action-text
|
||||||
:uppercase? components.styles/uppercase?} (i18n/label :t/edit)]]]])
|
:uppercase? true}
|
||||||
|
(i18n/label :t/edit)]]]])
|
||||||
|
|
||||||
(defn group-chat-profile-edit-toolbar []
|
(defn group-chat-profile-edit-toolbar []
|
||||||
[toolbar/toolbar {}
|
[toolbar/toolbar {}
|
||||||
|
@ -112,4 +113,4 @@
|
||||||
:action-label-style styles/action-label
|
:action-label-style styles/action-label
|
||||||
:action-separator-style styles/action-separator
|
:action-separator-style styles/action-separator
|
||||||
:icon-opts styles/action-icon-opts}]
|
:icon-opts styles/action-icon-opts}]
|
||||||
[members-list admin?]]]])))
|
[members-list admin?]]]])))
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
:accessibility-label :edit-button}
|
:accessibility-label :edit-button}
|
||||||
[react/view
|
[react/view
|
||||||
[react/text {:style common.styles/label-action-text
|
[react/text {:style common.styles/label-action-text
|
||||||
:uppercase? components.styles/uppercase?} (i18n/label :t/edit)]]]])
|
:uppercase? true}
|
||||||
|
(i18n/label :t/edit)]]]])
|
||||||
|
|
||||||
(defn my-profile-edit-toolbar []
|
(defn my-profile-edit-toolbar []
|
||||||
[toolbar/toolbar {}
|
[toolbar/toolbar {}
|
||||||
|
@ -80,7 +81,7 @@
|
||||||
[react/view styles/share-contact-code
|
[react/view styles/share-contact-code
|
||||||
[react/view styles/share-contact-code-text-container
|
[react/view styles/share-contact-code-text-container
|
||||||
[react/text {:style styles/share-contact-code-text
|
[react/text {:style styles/share-contact-code-text
|
||||||
:uppercase? components.styles/uppercase?}
|
:uppercase? true}
|
||||||
(i18n/label :t/share-contact-code)]]
|
(i18n/label :t/share-contact-code)]]
|
||||||
[react/view {:style styles/share-contact-icon-container
|
[react/view {:style styles/share-contact-icon-container
|
||||||
:accessibility-label :share-my-contact-code-button}
|
:accessibility-label :share-my-contact-code-button}
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
[react/view {:flex-direction :row}
|
[react/view {:flex-direction :row}
|
||||||
[react/text {:style styles/text-list-primary-content}
|
[react/text {:style styles/text-list-primary-content}
|
||||||
name]
|
name]
|
||||||
[react/text {:uppercase? true}
|
[react/text {:force-uppercase? true}
|
||||||
(clojure.core/name symbol)]]
|
(clojure.core/name symbol)]]
|
||||||
[list/item-secondary (wallet.utils/format-amount (symbol balance) decimals)]]]]])
|
[list/item-secondary (wallet.utils/format-amount (symbol balance) decimals)]]]]])
|
||||||
|
|
||||||
|
@ -207,4 +207,5 @@
|
||||||
(defn button-text [label]
|
(defn button-text [label]
|
||||||
[react/text {:style styles/button-text
|
[react/text {:style styles/button-text
|
||||||
:font (if platform/android? :medium :default)
|
:font (if platform/android? :medium :default)
|
||||||
:uppercase? (get-in platform/platform-specific [:uppercase?])} label])
|
:uppercase? true}
|
||||||
|
label])
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
[react/view styles/transaction-details-container
|
[react/view styles/transaction-details-container
|
||||||
[react/text {:style styles/transaction-details
|
[react/text {:style styles/transaction-details
|
||||||
:font (if platform/android? :medium :default)
|
:font (if platform/android? :medium :default)
|
||||||
:uppercase? (get-in platform/platform-specific [:uppercase?])}
|
:uppercase? true}
|
||||||
(i18n/label :t/view-transaction-details)]]]
|
(i18n/label :t/view-transaction-details)]]]
|
||||||
[components/separator]
|
[components/separator]
|
||||||
[react/touchable-highlight {:on-press #(re-frame/dispatch close-transaction-screen-event)
|
[react/touchable-highlight {:on-press #(re-frame/dispatch close-transaction-screen-event)
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
[react/view styles/got-it-container
|
[react/view styles/got-it-container
|
||||||
[react/text {:style styles/got-it
|
[react/text {:style styles/got-it
|
||||||
:font (if platform/android? :medium :default)
|
:font (if platform/android? :medium :default)
|
||||||
:uppercase? (get-in platform/platform-specific [:uppercase?])}
|
:uppercase? true}
|
||||||
(i18n/label :t/got-it)]]]]))
|
(i18n/label :t/got-it)]]]]))
|
||||||
|
|
||||||
(defview transaction-sent-modal []
|
(defview transaction-sent-modal []
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
[list/section-list {:sections (wrap-filter-data filter-data)}]]]))
|
[list/section-list {:sections (wrap-filter-data filter-data)}]]]))
|
||||||
|
|
||||||
(defn history-tab [active?]
|
(defn history-tab [active?]
|
||||||
[react/text {:uppercase? true
|
[react/text {:force-uppercase? true
|
||||||
:style (styles/tab-title active?)
|
:style (styles/tab-title active?)
|
||||||
:accessibility-label :history-button}
|
:accessibility-label :history-button}
|
||||||
(i18n/label :t/transactions-history)])
|
(i18n/label :t/transactions-history)])
|
||||||
|
@ -183,7 +183,7 @@
|
||||||
(letsubs [unsigned-transactions-count [:wallet.transactions/unsigned-transactions-count]]
|
(letsubs [unsigned-transactions-count [:wallet.transactions/unsigned-transactions-count]]
|
||||||
[react/view {:flex-direction :row}
|
[react/view {:flex-direction :row}
|
||||||
[react/text {:style (styles/tab-title active?)
|
[react/text {:style (styles/tab-title active?)
|
||||||
:uppercase? true
|
:force-uppercase? true
|
||||||
:accessibility-label :unsigned-transactions-button}
|
:accessibility-label :unsigned-transactions-button}
|
||||||
(i18n/label :t/transactions-unsigned)]
|
(i18n/label :t/transactions-unsigned)]
|
||||||
(when (pos? unsigned-transactions-count)
|
(when (pos? unsigned-transactions-count)
|
||||||
|
|
Loading…
Reference in New Issue