9 Commits

Author SHA1 Message Date
Torleif Berger
bedbad7231
fix: 🐛 correct useMeasure typings
When upgrading to v15, I discovered some issues with `useMeasure` forcing me to downgrade to v14 again. Hopefully these changes fixes those issues...

* It was no longer possible to define the ref type, meaning components requiring a certain type of ref would reject it. Fixed this by making the function generic again.
* Previously you _had to_ define the ref type, while in v15 you _couldn't_. Fixed this by giving the generic type a default type of `HTMLElement`.
* The implicit typing of `useMeasureMock` combined with the ternary default export statement made the imported type of `useMeasure` very messy. Fixed this by making the type of `useMeasureMock` explicitly match `useMeasure`.
2020-05-18 14:35:40 +02:00
streamich
9ae494fc18 fix: 🐛 correctly test if env is browser in useMeasure 2020-05-16 14:53:56 +02:00
streamich
dc92b646d0 fix: 🐛 revert useMeasure defaults to zeros 2020-05-16 14:53:10 +02:00
streamich
2a13fbae45 feat: 🎸 remove resize-observer-polyfill from useMeasure
BREAKING CHANGE: resize-observer-polyfill package is not used with useMeasure() hook
anymore.
2020-05-16 14:46:41 +02:00
streamich
866f3d740b feat: 🎸 mock useMeasure() hook on server and w/o ResizeObserver 2020-05-16 14:39:37 +02:00
streamich
a164843902 feat: 🎸 improve implementation of useMeasure() hook
BREAKING CHANGE: useMeasure() now defaults all values to -1, if they were not set and
internal implementation heavily refactored.
2020-05-16 14:39:20 +02:00
Anton Zinovyev
8de2a3ee13 chore: move tests to top level /tests folder
chore: move all the tests to the separate directory outside of sources;

chore: remove jest.config.js (config moved to the package.json);

test: unused import in test;

test: 💍 fix tests add back x and y to useMeasure

chore: 🤖 add linter to /tests folder

ci: 🎡 limit Jest worker count for CircleCI
2019-11-08 16:55:34 -05:00
lintuming
4deb48b35e add useMeasure story 2019-08-28 09:28:28 +08:00
lintuming
fea782051e useMeasure 2019-08-23 18:53:41 +08:00