@graphcommerce/framer-scroller 6.2.0-canary.34 → 6.2.0-canary.35

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## 6.2.0-canary.35
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1954](https://github.com/graphcommerce-org/graphcommerce/pull/1954) [`ec82fe49c`](https://github.com/graphcommerce-org/graphcommerce/commit/ec82fe49cd9aa0865b6c21eb405f05d8596748f6) - fix: prevent overlays from aut-closing on iOS 14 ([@FrankHarland](https://github.com/FrankHarland))
8
+
3
9
  ## 6.2.0-canary.34
4
10
 
5
11
  ## 6.2.0-canary.33
@@ -114,10 +114,24 @@ export function ScrollerProvider(props: ScrollerProviderProps) {
114
114
 
115
115
  const enableSnap = useCallback(() => {
116
116
  if (snap.get() === true) return
117
- if (scrollerRef.current) scrollerRef.current.style.scrollSnapType = ''
117
+ const scroller = scrollerRef.current
118
+ if (scroller) scroller.style.scrollSnapType = ''
118
119
 
119
120
  snap.set(true)
120
121
  scroll.animating.set(false)
122
+ // Fix for iOS Safari 14 where the scrollPosition would be reset to 0.
123
+ if (scroller) {
124
+ const { scrollLeft, scrollTop } = scroller
125
+ requestAnimationFrame(() => {
126
+ // We're forcing a layout calculation, else Safari 14 will still close.
127
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
128
+ const forceLayout = scroller.scrollTop
129
+ requestAnimationFrame(() => {
130
+ if (scroller.scrollTop === 0 && scrollTop !== 0) scroller.scrollTop = scrollTop
131
+ if (scroller.scrollLeft === 0 && scrollLeft !== 0) scroller.scrollLeft = scrollLeft
132
+ })
133
+ })
134
+ }
121
135
  }, [snap, scroll])
122
136
 
123
137
  useObserveItems(scrollerRef, items)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/framer-scroller",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "6.2.0-canary.34",
5
+ "version": "6.2.0-canary.35",
6
6
  "sideEffects": false,
7
7
  "scripts": {
8
8
  "dev": "tsc -W"
@@ -16,13 +16,13 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "popmotion": "11.0.5",
19
- "@graphcommerce/framer-utils": "6.2.0-canary.34",
20
- "@graphcommerce/image": "6.2.0-canary.34"
19
+ "@graphcommerce/framer-utils": "6.2.0-canary.35",
20
+ "@graphcommerce/image": "6.2.0-canary.35"
21
21
  },
22
22
  "devDependencies": {
23
- "@graphcommerce/eslint-config-pwa": "6.2.0-canary.34",
24
- "@graphcommerce/prettier-config-pwa": "6.2.0-canary.34",
25
- "@graphcommerce/typescript-config-pwa": "6.2.0-canary.34"
23
+ "@graphcommerce/eslint-config-pwa": "6.2.0-canary.35",
24
+ "@graphcommerce/prettier-config-pwa": "6.2.0-canary.35",
25
+ "@graphcommerce/typescript-config-pwa": "6.2.0-canary.35"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "@mui/material": "^5.10.16",