set maxFontSizeMultiplier for text and text-input components on iOS
This commit is contained in:
parent
9b47275249
commit
ce64bb8c1f
|
@ -87,17 +87,24 @@
|
||||||
|
|
||||||
(def slider (get-class "Slider"))
|
(def slider (get-class "Slider"))
|
||||||
|
|
||||||
|
(def max-font-size-multiplier 1.25)
|
||||||
|
|
||||||
|
(defn prepare-text-props [props]
|
||||||
|
(-> props
|
||||||
|
(update :style typography/get-style)
|
||||||
|
(assoc :max-font-size-multiplier max-font-size-multiplier)))
|
||||||
|
|
||||||
;; Accessor methods for React Components
|
;; Accessor methods for React Components
|
||||||
(defn text
|
(defn text
|
||||||
"For nested text elements, use nested-text instead"
|
"For nested text elements, use nested-text instead"
|
||||||
([text-element]
|
([text-element]
|
||||||
[text {} text-element])
|
[text {} text-element])
|
||||||
([options text-element]
|
([options text-element]
|
||||||
[text-class (update options :style typography/get-style) text-element]))
|
[text-class (prepare-text-props options) text-element]))
|
||||||
|
|
||||||
(defn nested-text
|
(defn nested-text
|
||||||
([options & nested-text-elements]
|
([options & nested-text-elements]
|
||||||
(let [options-with-style (update options :style typography/get-style)]
|
(let [options-with-style (prepare-text-props options)]
|
||||||
(reduce (fn [acc text-element]
|
(reduce (fn [acc text-element]
|
||||||
(conj acc
|
(conj acc
|
||||||
(cond
|
(cond
|
||||||
|
@ -106,9 +113,9 @@
|
||||||
|
|
||||||
(vector? text-element)
|
(vector? text-element)
|
||||||
(let [[options nested-text-elements] text-element]
|
(let [[options nested-text-elements] text-element]
|
||||||
[nested-text (update (utils.core/deep-merge options-with-style
|
[nested-text (prepare-text-props
|
||||||
options)
|
(utils.core/deep-merge options-with-style
|
||||||
:style typography/get-style)
|
options))
|
||||||
nested-text-elements]))))
|
nested-text-elements]))))
|
||||||
[text-class options-with-style]
|
[text-class options-with-style]
|
||||||
nested-text-elements))))
|
nested-text-elements))))
|
||||||
|
@ -118,6 +125,7 @@
|
||||||
[text-input-class
|
[text-input-class
|
||||||
(merge
|
(merge
|
||||||
{:underline-color-android :transparent
|
{:underline-color-android :transparent
|
||||||
|
:max-font-size-multiplier max-font-size-multiplier
|
||||||
:placeholder-text-color colors/text-gray
|
:placeholder-text-color colors/text-gray
|
||||||
:placeholder (i18n/label :t/type-a-message)
|
:placeholder (i18n/label :t/type-a-message)
|
||||||
:value text}
|
:value text}
|
||||||
|
|
Loading…
Reference in New Issue