@asgard-js/react 0.0.43-canary.25 → 0.0.43-canary.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgard-js/react",
3
- "version": "0.0.43-canary.25",
3
+ "version": "0.0.43-canary.26",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -54,7 +54,7 @@
54
54
  "vitest": "^1.6.0"
55
55
  },
56
56
  "peerDependencies": {
57
- "@asgard-js/core": "^0.0.43-canary.25",
57
+ "@asgard-js/core": "^0.0.43-canary.26",
58
58
  "react": "^18.0.0",
59
59
  "react-dom": "^18.0.0"
60
60
  },
@@ -20,12 +20,12 @@ export function ChatbotFullScreenContainer(
20
20
 
21
21
  usePreventOverScrolling(containerRef);
22
22
 
23
- useOnScreenKeyboardScrollFix();
24
-
25
23
  const [, height] = useViewportSize() ?? [];
26
24
 
27
25
  const isOnScreenKeyboardOpen = useIsOnScreenKeyboardOpen();
28
26
 
27
+ useOnScreenKeyboardScrollFix(isOnScreenKeyboardOpen);
28
+
29
29
  const styles = useMemo(() => {
30
30
  return Object.assign(
31
31
  theme?.chatbot?.backgroundColor
@@ -1,7 +1,9 @@
1
1
  import { useEffect } from 'react';
2
2
 
3
- export function useOnScreenKeyboardScrollFix(): void {
3
+ export function useOnScreenKeyboardScrollFix(isOnScreenKeyboardOpen: boolean): void {
4
4
  useEffect(() => {
5
+ if (!isOnScreenKeyboardOpen) return;
6
+
5
7
  function handleScroll(): void {
6
8
  window.scrollTo(0, 0);
7
9
  }
@@ -11,5 +13,5 @@ export function useOnScreenKeyboardScrollFix(): void {
11
13
  return (): void => {
12
14
  window.removeEventListener('scroll', handleScroll);
13
15
  };
14
- }, []);
16
+ }, [isOnScreenKeyboardOpen]);
15
17
  }