Skip to content

Commit de0e277

Browse files
authored
fix: navbar state change (#4406)
1 parent b5943db commit de0e277

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

.changeset/smart-oranges-peel.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@nextui-org/navbar": patch
3+
---
4+
5+
6+
Resolving the issue preventing the navbar from opening(#4345)

packages/components/navbar/src/use-navbar.ts

+5
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ export function useNavbar(originalProps: UseNavbarProps) {
161161
ref: domRef,
162162
onResize: () => {
163163
const currentWidth = domRef.current?.offsetWidth;
164+
const scrollWidth = window.innerWidth - document.documentElement.clientWidth;
165+
166+
if (currentWidth && currentWidth + scrollWidth == prevWidth.current) {
167+
return;
168+
}
164169

165170
if (currentWidth !== prevWidth.current) {
166171
updateWidth();

0 commit comments

Comments
 (0)