140 Commits

Author SHA1 Message Date
Mahmoud El-Gammal
3eb531ac9e feat: add onChange callback to useWindowSize 2024-12-02 16:51:00 +02:00
atiteux
75218e45df feat(pencil): add isFirst and isLast return value to 'useStateList' 2024-01-22 11:11:34 +01:00
Va Da
06afdf7b03
Merge pull request #2535 from suisous/pr/suisous
feat: Add clear() to useSet
2024-01-15 12:37:35 +01:00
Nam Nguyen
e7379f0887 fix: update useMedia hook to use recommended approach of MDN 2024-01-10 13:41:29 -04:00
suisous
a6bc11996b Update test of useSet 2024-01-05 15:14:34 +09:00
xg4
20b78178d0 fix: resolve @types/react@18 break change, React.FC 2022-04-08 16:09:22 +08:00
Teague Stockwell
5c01189412
fix: useMedia SSR hydration bug with defaultState (#2216)
* fix: useMedia SSR hydration bug with defaultState

Prevent a React hydration mismatch when a default value is provided
by not defaulting to window.matchMedia(query).matches.

* Refactor nested ifs
2021-12-30 15:31:24 +01:00
Alexander Kachkaev
d2028ae44c
Run "yarn lint --fix" 2021-08-31 22:22:38 +01:00
longwanxiang
3203610efd feat: useAudio add playing state 2021-08-27 18:28:04 +08:00
Anton Zinovyev
a6d00b8f77
Merge pull request #1812 from n4bb12/pr/ensuredForwardRef-test-coverage
test: Add test coverage for ensuredForwardRef
2021-04-23 10:18:03 +03:00
Arnaud de Surirey
fdd1b23fd7 fix(useLocalStorage): reinitialize on key change 2021-04-14 15:27:11 +02:00
Anton Zinovyev
db66320fb8
Merge pull request #1684 from QingqiShi/patch-1
fix(useStateWithHistory): support callback style setState
2021-04-06 11:15:43 +03:00
xobotyi
3e8af15086
fix: lint issues. 2021-03-11 12:55:24 +03:00
Victor Tiurin
6b708c880d fix for useWindowScroll may lose window scroll change at mount #1699
Update tests/useWindowScroll.test.tsx

Co-authored-by: Mathias <mathiassoeholm@gmail.com>

fix for useWindowScroll may lose window scroll change at mount #1699, fixes for review by mathiassoeholm

Update tests/useWindowScroll.test.tsx

Co-authored-by: Mathias <mathiassoeholm@gmail.com>
2021-03-11 10:50:54 +02:00
Anton Zinovyev
e3adac01af
Merge branch 'master' into patch-3 2021-03-10 18:38:01 +03:00
xobotyi
dc5bbe0e94
fix: lint issues. 2021-03-10 18:01:21 +03:00
kodai3
72f4cb9b40 fix: delete isClient 2021-03-09 23:18:34 +09:00
Edwin Joseph
f9c743fa83 fix(useOrientation): update tests to increase coverage 2021-03-09 23:08:29 +09:00
Edwin Joseph
f45cb707b5 feat(useOrientation): add tests 2021-03-09 23:08:15 +09:00
Juan Lulkin
b7f1939097 Uses resolveHookState and its types 2021-02-16 09:45:03 +01:00
Juan Lulkin
eb2a285aa7 Revert back to single quotes 2021-02-15 21:00:14 +01:00
Juan Lulkin
0713ed68c6 feat:Makes createGlobalState API compatible with React 2021-02-15 20:57:05 +01:00
Abraham Schilling
86ea576c7e test: Add test coverage for ensuredForwardRef 2021-02-10 22:38:03 +01:00
xobotyi
b6993a6f95
feat(prettier): make prettier a part of eslint.
Also reduce max line width to 100. And remove `lint:types` step for
commit sequence, it bothers when committing incomplete (wip) changes.
2021-02-01 18:58:55 +03:00
xobotyi
0636cd87f4
chore(useUpdate): improve useUpdate test suite 2021-01-31 11:28:36 +03:00
xobotyi
a087deb48e
fix: proper definition for isBrowser and isNavigator states.
should fix: #1777

Also introduce jest config for ssr tests (it fails hard now).
2021-01-31 10:33:48 +03:00
xobotyi
23037f207d
feat: refactor the useNetwork hook.
Improved hook performance, now works with safari.

BREAKING CHANGE: `useNetwork` hook renamed to `useNetworkState`.
2021-01-31 03:14:20 +03:00
Renovate Bot
a27f09fd36
chore: refactoring and rearrangement.
More DRY code. Also move non-hooks to separate directories.

BREAKING CHANGE: all `create*` factories been moved to `factory` subdirectory and in case direct import should be imported like `react-use/esm/factory/createBreakpoint`
BREAKING CHANGE: `comps` directory renamed to `component`
2021-01-30 23:30:26 +03:00
CRIMX
c7e13bd59f
test: add rerender test for useUnmountPromise 2021-01-29 20:03:48 +08:00
Qingqi Shi
015d491ce7
test: update test for userStateWithHistory 2020-12-06 14:54:01 +00:00
dovidweisz
7668ce5c5f fix: Fix issues in tests 2020-11-27 13:15:45 -05:00
Anton Zinovyev
22211d9720
Merge pull request #1337 from ddaza/master
chore: Removed eslint comments, added global formatting, fixed errors
2020-09-04 23:34:36 +03:00
Anton Zinovyev
42ee224eb5
Merge pull request #1369 from SebastianM/debounce-test-descr
chore(useDebounce): fix test description
2020-09-04 10:34:28 +03:00
Necmettin Karakaya
74b49d8e58 Fix typo 👇🏻
https://github.com/streamich/react-use/blob/master/tests/useCopyToClipboard.test.ts#L55: corrected "emtpy" to "empty"
2020-07-21 23:35:15 +08:00
Sebastian Holstein
19f77387e6 chore(useDebounce): fix test description 2020-07-19 22:47:27 +02:00
ddaza
228ce59df3 fixed tests 2020-07-02 16:29:03 -05:00
ddaza
db07ab65bf updated formating and fixed errors 2020-07-02 14:56:15 -05:00
streamich
e33cf9f87b chore: 🤖 catch up with master 2020-05-18 16:03:20 +02:00
Vadim Dalecky
4aa573dfeb
Merge branch 'master' into feature/correct-spelling 2020-05-16 15:58:12 +02:00
streamich
87fbe1534c chore: 🤖 add latest useMeasure hook changes (#1213) 2020-05-16 15:03:42 +02:00
streamich
e1dbd39f18 chore: 🤖 catch up with master 2020-05-16 14:59:21 +02:00
streamich
dc92b646d0 fix: 🐛 revert useMeasure defaults to zeros 2020-05-16 14:53:10 +02:00
streamich
d06688b26e style: 💄 remove unused constructors 2020-05-16 14:49:13 +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
Clément Paris
d6fe267615 feat: add useLatest hook 2020-05-10 18:09:30 +02:00
whincwu
44a6cde00e feat: add useHash hook 2020-04-08 09:21:06 +03:00
xobotyi
baa2f7511e
feat(useRafLoop): reworked the hook, now it do not re-render parent component.
BREAKING CHANGE: changed return array, now it returns only functions in next order: [stop, start, isActive].

Parent component is not re-rendered on loop start/stop.
2020-04-01 10:43:31 +03:00
xobotyi
1ef1272d6d
feat(useRafLoop): implement #1090 2020-04-01 08:49:05 +03:00
Mike Rogers
e4eec7bf63 correcting spelling mistakes 2020-03-05 11:36:43 +00:00
Octave Raimbault
477614f9ef
feat(useSet): add toggle a method (#968)
Co-authored-by: Ward <wardoosterlijnck@gmail.com>
2020-03-03 14:00:40 +11:00