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

input-text does not respect parent's flex settings #167

Closed
aeberts opened this issue Oct 28, 2017 · 4 comments
Closed

input-text does not respect parent's flex settings #167

aeberts opened this issue Oct 28, 2017 · 4 comments
Assignees

Comments

@aeberts
Copy link

aeberts commented Oct 28, 2017

My apologies if this is a misunderstanding of flexbox or how re-com works.

Note: The snippets below comes from:
https://github.com/aeberts/redoo/blob/728015f4ea2622a669d753e6a8d4835d6a33685c/src/cljs/redoo/views.cljs#L22)

The input-text component doesn't seem to respect the flex settings of it's parent container:

(defn new-todo-input
  [{:keys [on-save]}]
  (let [val (r/atom "")
        stop #(reset! val "")
        save #(let [v (-> @val str clojure.string/trim)]
                (when (seq v) (on-save v))
                (stop))]
    (fn []
      [rc/box
       :size "auto"
       :child [rc/input-text
               :model val
               :placeholder "Enter a new todo"
               :on-change #(do (reset! val %)
                               (save))
               :change-on-blur? true]])))

Expected: rc/input-text inherits the flex settings of rc/box (i.e. :size "auto")

Actual: rc/input-text has a flex setting of: 0 0 auto

@nakiya
Copy link

nakiya commented Feb 25, 2018

Hi @aeberts, Did you manage to resolve this issue? I have the exact same problem.

@aeberts
Copy link
Author

aeberts commented Feb 25, 2018

Hi @nakiya, I think the workaround would be to put the flex-box settings in the :style parameter or add a custom :class and style it from your css file. It's not as elegant as having a :size parameter in the input-text but I believe it would work (disclaimer: I haven't tried it yet myself).

@MawiraIke
Copy link
Contributor

Unfortunately yes, in re-com, children take their own styling like flex, align e.t.c. If not provided, sometimes they get assigned to some calculated component defaults. For example in input-text, I think what you are seeing is the flex defaulting to none as seen here.

@superstructor
Copy link
Contributor

This will be resolved by #284. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants