GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ReScript React Native
  • Docs
  • Components
  • APIs
  • Blog
  • GitHub
  • AccessibilityInfo
  • ActionSheetIOS
  • Alert
  • Animated
  • AnimationFrame
  • AppRegistry
  • AppState
  • BackHandler

This view

  • Original page
  • New address

GeezerVison is showing rescript-react-native.github.io — AnimationFrame | ReScript React Native

request​

AnimationFrame.request is just the well known requestAnimationFrame.

In React Native, requestAnimationFrame has been polyfilled from the browser. It accepts a function as its only argument and calls that function before the next repaint.

Note that calback doesn't receive an argument unlike the window.requestAnimationFrame implementation.

This method returns a requestID so you can cancel if needed. If you don't need it, you can just ignore the result.

AnimationFrame.request(() => {
// do whatever you need on next paint
})->ignore

cancel​

AnimationFrame.cancel method cancels an animation frame request previously scheduled. It's just calling cancelAnimationFrame.

let requestID = AnimationFrame.request(() => {
// do whatever you need on next paint
})

// elsewhere or later
if whatever {
AnimationFrame.cancel(requestID);
}
  • request
  • cancel
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.