Fixes #3847: Half of the line is cut in the input field if focus is on the next line [Android]
This commit is contained in:
parent
f94e1c5826
commit
d430d74781
|
@ -14,8 +14,16 @@
|
||||||
[status-im.ui.components.colors :as colors]
|
[status-im.ui.components.colors :as colors]
|
||||||
[status-im.ui.components.react :as react]
|
[status-im.ui.components.react :as react]
|
||||||
[status-im.ui.components.icons.vector-icons :as vi]
|
[status-im.ui.components.icons.vector-icons :as vi]
|
||||||
|
[status-im.utils.platform :as platform]
|
||||||
[status-im.utils.utils :as utils]))
|
[status-im.utils.utils :as utils]))
|
||||||
|
|
||||||
|
;; TODO(pacamara) Symptomatic fix, root cause is react-native onLayout returning
|
||||||
|
;; inconsistent height values, more investigation needed
|
||||||
|
(defn android-blank-line-extra-height [input-text]
|
||||||
|
(if (and platform/android? input-text (string/ends-with? input-text "\n"))
|
||||||
|
(/ style/min-input-height 2)
|
||||||
|
0))
|
||||||
|
|
||||||
(defview basic-text-input [{:keys [set-layout-height-fn set-container-width-fn height single-line-input?]}]
|
(defview basic-text-input [{:keys [set-layout-height-fn set-container-width-fn height single-line-input?]}]
|
||||||
(letsubs [{:keys [input-text]} [:get-current-chat]
|
(letsubs [{:keys [input-text]} [:get-current-chat]
|
||||||
input-focused? [:get-current-chat-ui-prop :input-focused?]
|
input-focused? [:get-current-chat-ui-prop :input-focused?]
|
||||||
|
@ -77,7 +85,8 @@
|
||||||
[react/text {:style (style/invisible-input-text-height container-width)
|
[react/text {:style (style/invisible-input-text-height container-width)
|
||||||
:on-layout #(let [h (-> (.-nativeEvent %)
|
:on-layout #(let [h (-> (.-nativeEvent %)
|
||||||
(.-layout)
|
(.-layout)
|
||||||
(.-height))]
|
(.-height)
|
||||||
|
(+ (android-blank-line-extra-height input-text)))]
|
||||||
(set-layout-height-fn h))}
|
(set-layout-height-fn h))}
|
||||||
(or input-text "")]))
|
(or input-text "")]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue