Skip to content

Commit 1c9b429

Browse files
committed
fix: use "frameLoop.onFrame" in Parallax
Closes #820
1 parent 3ccdfe7 commit 1c9b429

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/addons/src/parallax.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import React, {
55
useEffect,
66
CSSProperties,
77
} from 'react'
8-
import { requestAnimationFrame, defaultElement as View } from 'shared/globals'
8+
import { frameLoop, defaultElement as View } from 'shared/globals'
99
import { Controller, SpringConfig, config as configs } from '@react-spring/core'
1010
import { withAnimated } from '@react-spring/animated'
1111
import { useMemoOne } from 'use-memo-one'
@@ -239,7 +239,7 @@ export const Parallax = React.memo(
239239
if (!state.busy) {
240240
state.busy = true
241241
state.current = event.target[getScrollType(horizontal)]
242-
requestAnimationFrame(() => {
242+
frameLoop.onFrame(() => {
243243
state.layers.forEach(layer =>
244244
layer.setPosition(state.space, state.current)
245245
)
@@ -254,7 +254,7 @@ export const Parallax = React.memo(
254254

255255
const onResize = () => {
256256
const update = () => state.update()
257-
requestAnimationFrame(update)
257+
frameLoop.onFrame(update)
258258
setTimeout(update, 150) // Some browsers don't fire on maximize!
259259
}
260260

0 commit comments

Comments
 (0)