@shopgate/engage 7.30.4 → 7.30.5

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.
@@ -1,7 +1,7 @@
1
1
  import React, { useState, forwardRef, useEffect } from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import classNames from 'classnames';
4
- import { useScrollDirectionChange } from '@shopgate/engage/core/hooks';
4
+ import { useScrollDirectionChange, useRoute } from '@shopgate/engage/core/hooks';
5
5
  import { root, scrolledIn, scrolledOut, transition } from "./style";
6
6
 
7
7
  /* eslint-disable react/prop-types */
@@ -40,8 +40,15 @@ function ScrollHeaderBase({
40
40
  classes
41
41
  }, ref) {
42
42
  const [shouldHideHeader, setShouldHideHeader] = useState(false);
43
+
44
+ // The `viewScroll$` stream is shared across all mounted views. Cached routes (e.g. a product
45
+ // list) stay mounted in the background while another route is active, so without this guard the
46
+ // header would react to scroll events emitted by a different, currently visible view and end up
47
+ // hidden when the user navigates back. `visible` is true only for the active route.
48
+ const route = useRoute();
49
+ const visible = route ? route.visible !== false : true;
43
50
  useScrollDirectionChange({
44
- enabled: hideOnScroll,
51
+ enabled: hideOnScroll && visible,
45
52
  offset: scrollOffset,
46
53
  onlyFireOnScrollUpAtTop: onlyShowAtTop,
47
54
  onlyFireOnScrollUpAtTopOffset: onlyShowAtTopOffset,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.30.4",
3
+ "version": "7.30.5",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -17,12 +17,12 @@
17
17
  "dependencies": {
18
18
  "@emotion/react": "^11.14.0",
19
19
  "@shopgate/native-modules": "1.0.0-beta.25",
20
- "@shopgate/pwa-common": "7.30.4",
21
- "@shopgate/pwa-common-commerce": "7.30.4",
22
- "@shopgate/pwa-core": "7.30.4",
23
- "@shopgate/pwa-ui-ios": "7.30.4",
24
- "@shopgate/pwa-ui-material": "7.30.4",
25
- "@shopgate/pwa-ui-shared": "7.30.4",
20
+ "@shopgate/pwa-common": "7.30.5",
21
+ "@shopgate/pwa-common-commerce": "7.30.5",
22
+ "@shopgate/pwa-core": "7.30.5",
23
+ "@shopgate/pwa-ui-ios": "7.30.5",
24
+ "@shopgate/pwa-ui-material": "7.30.5",
25
+ "@shopgate/pwa-ui-shared": "7.30.5",
26
26
  "@stripe/react-stripe-js": "^1.16.5",
27
27
  "@stripe/stripe-js": "^1.44.1",
28
28
  "@virtuous/conductor": "~2.5.0",