nkbt / react-height

Component-wrapper to determine and report children elements height
MIT License
180 stars 27 forks source link

[Feature request] option to include border in the measurement #20

Closed Andarist closed 7 years ago

Andarist commented 7 years ago

Just like in the title. I could provide PR for this if you find this useful

nkbt commented 7 years ago

Hi @Andarist I decided not to go this way from the beginning, since it also means supporting margins and all sorts of other css things. I suggest just to wrap element with borders/margins into a plain one that will be measured instead.

Just writing this I realized that alternatively we could accept an optional callback that can pick any element values and if not provided use default like:

getElementHeight(element) {
  return element.clientHeight;
}

So if you wish to include borders or margins - or anything else - you will be able to do so easily.

Andarist commented 7 years ago

Yeah, that's probably a reasonable default with provided ability to calculate the height as the user wish, so the lib doesnt have to worry about about all of this, and not even consider box-sizing etc.

I might make a PR for this 2morrow, should I proceed with this?

nkbt commented 7 years ago

Would be fantastic! On Tue, 17 Jan 2017 at 10:18, Mateusz Burzyński notifications@github.com wrote:

Yeah, that's probably a reasonable default with provided ability to calculate the height as the user wish, so the lib doesnt have to worry about about all of this, and not even consider box-sizing etc.

I might make a PR for this 2morrow, should I proceed with this?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/nkbt/react-height/issues/20#issuecomment-272983566, or mute the thread https://github.com/notifications/unsubscribe-auth/AAKsoFCKnbms41qAY9_RjqYdabANGr4Pks5rS_qYgaJpZM4Lkvt1 .