Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#19265] fix: cursor overlapping placeholder in android #19526

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/quo/components/inputs/input/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@
"Custom properties that must be removed from properties map passed to InputText."
[:type :blur? :error? :right-icon :left-icon :disabled? :small? :button
:label :char-limit :on-char-limit-reach :icon-name :multiline? :on-focus :on-blur
:container-style :input-container-style :ref])
:container-style :input-container-style :ref :placeholder])

(defn- base-input
[{:keys [blur? error? right-icon left-icon disabled? small? button
label char-limit multiline? clearable? on-focus on-blur container-style input-container-style
on-change-text on-char-limit-reach weight default-value on-clear]
on-change-text on-char-limit-reach weight default-value on-clear placeholder]
:as props}]
(let [theme (quo.theme/use-theme-value)
ref (rn/use-ref-atom nil)
Expand Down Expand Up @@ -110,7 +110,10 @@
{:style-fn style/clear-icon
:icon-name :i/clear
:on-press clear-on-press}))
clean-props (apply dissoc props custom-props)]
clean-props (apply dissoc props custom-props)
;; Workaround for android cursor overlapping placeholder
;; https://github.com/facebook/react-native/issues/27687
modified-placeholder (if platform/android? (str "\u2009" placeholder) placeholder)]
[rn/view {:style container-style}
(when (or label char-limit)
[label-&-counter
Expand All @@ -134,6 +137,7 @@
:keyboard-appearance (quo.theme/theme-value :light :dark theme)
:cursor-color (:cursor variant-colors)
:editable (not disabled?)
:placeholder modified-placeholder
:on-focus (fn []
(when on-focus (on-focus))
(internal-on-focus))
Expand Down