diff --git a/releases/next/docs/animated.html b/releases/next/docs/animated.html index c4cbd03aa33..ec5c76d2b1d 100644 --- a/releases/next/docs/animated.html +++ b/releases/next/docs/animated.html @@ -3,7 +3,13 @@ { toValue: 1, // Animate to final value of 1 } -).start(); // Start the animation

Refer to the Animations guide to see additional examples of Animated in action.

Overview #

There are two value types you can use with Animated:

Animated.Value can bind to style properties or other props, and can be interpolated as well. A single Animated.Value can drive any number of properties.

Configuring animations #

Animated provides three types of animation types. Each animation type provides a particular animation curve that controls how your values animate from their initial value to the final value:

In most cases, you will be using timing(). By default, it uses a symmetric easeInOut curve that conveys the gradual acceleration of an object to full speed and concludes by gradually decelerating to a stop.

Working with animations #

Animations are started by calling start() on your animation. start() takes a completion callback that will be called when the animation is done. If the animation finished running normally, the completion callback will be invoked with {finished: true}. If the animation is done because stop() was called on it before it could finish (e.g. because it was interrupted by a gesture or another animation), then it will receive {finished: false}.

Using the native driver #

By using the native driver, we send everything about the animation to native before starting the animation, allowing native code to perform the animation on the UI thread without having to go through the bridge on every frame. Once the animation has started, the JS thread can be blocked without affecting the animation.

You can use the native driver by specifying useNativeDriver: true in your animation configuration. See the Animations guide to learn more.

Animatable components #

Only animatable components can be animated. These special components do the magic of binding the animated values to the properties, and do targeted native updates to avoid the cost of the react render and reconciliation process on every frame. They also handle cleanup on unmount so they are safe by default.

Animated exports the following animatable components using the above wrapper:

Composing animations #

Animations can also be combined in complex ways using composition functions:

Animations can also be chained together simply by setting the toValue of one animation to be another Animated.Value. See Tracking dynamic values in the Animations guide.

By default, if one animation is stopped or interrupted, then all other animations in the group are also stopped.

Combining animated values #

You can combine two animated values via addition, multiplication, division, or modulo to make a new animated value:

Interpolation #

The interpolate() function allows input ranges to map to different output ranges. By default, it will extrapolate the curve beyond the ranges given, but you can also have it clamp the output value. It uses lineal interpolation by default but also supports easing functions.

Read more about interpolation in the Animation guide.

Handling gestures and other events #

Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event(). This is done with a structured map syntax so that values can be extracted from complex event objects. The first level is an array to allow mapping across multiple args, and that array contains nested objects.

For example, when working with horizontal scrolling gestures, you would do the following in order to map event.nativeEvent.contentOffset.x to scrollX (an Animated.Value):

onScroll={Animated.event( +).start(); // Start the animation

Refer to the Animations guide to see additional examples of Animated in action.

Overview #

There are two value types you can use with Animated:

Animated.Value can bind to style properties or other props, and can be interpolated as well. A single Animated.Value can drive any number of properties.

Configuring animations #

Animated provides three types of animation types. Each animation type provides a particular animation curve that controls how your values animate from their initial value to the final value:

In most cases, you will be using timing(). By default, it uses a symmetric easeInOut curve that conveys the gradual acceleration of an object to full speed and concludes by gradually decelerating to a stop.

Working with animations #

Animations are started by calling start() on your animation. start() takes a completion callback that will be called when the animation is done. If the animation finished running normally, the completion callback will be invoked with {finished: true}. If the animation is done because stop() was called on it before it could finish (e.g. because it was interrupted by a gesture or another animation), then it will receive {finished: false}.

this.animateValue.spring({}).start(({finished}) => { + if (finished) { + console.log('Animation was completed') + } else { + console.log('Animation was aborted') + } +})

Using the native driver #

By using the native driver, we send everything about the animation to native before starting the animation, allowing native code to perform the animation on the UI thread without having to go through the bridge on every frame. Once the animation has started, the JS thread can be blocked without affecting the animation.

You can use the native driver by specifying useNativeDriver: true in your animation configuration. See the Animations guide to learn more.

Animatable components #

Only animatable components can be animated. These special components do the magic of binding the animated values to the properties, and do targeted native updates to avoid the cost of the react render and reconciliation process on every frame. They also handle cleanup on unmount so they are safe by default.

Animated exports the following animatable components using the above wrapper:

Composing animations #

Animations can also be combined in complex ways using composition functions:

Animations can also be chained together simply by setting the toValue of one animation to be another Animated.Value. See Tracking dynamic values in the Animations guide.

By default, if one animation is stopped or interrupted, then all other animations in the group are also stopped.

Combining animated values #

You can combine two animated values via addition, multiplication, division, or modulo to make a new animated value:

Interpolation #

The interpolate() function allows input ranges to map to different output ranges. By default, it will extrapolate the curve beyond the ranges given, but you can also have it clamp the output value. It uses lineal interpolation by default but also supports easing functions.

Read more about interpolation in the Animation guide.

Handling gestures and other events #

Gestures, like panning or scrolling, and other events can map directly to animated values using Animated.event(). This is done with a structured map syntax so that values can be extracted from complex event objects. The first level is an array to allow mapping across multiple args, and that array contains nested objects.

For example, when working with horizontal scrolling gestures, you would do the following in order to map event.nativeEvent.contentOffset.x to scrollX (an Animated.Value):

onScroll={Animated.event( // scrollX = e.nativeEvent.contentOffset.x [{ nativeEvent: { contentOffset: { diff --git a/versions.html b/versions.html index 20ca6f3ff68..9d7f85729cb 100644 --- a/versions.html +++ b/versions.html @@ -1,4 +1,4 @@ -React Native Versions - React Native

React Native Versions

React Native follows a monthly release train. Every month, a new branch created off master enters the Release Candidate phase, and the previous Release Candidate branch is released and considered stable.

If you have an existing project that uses React Native, read the release notes to learn about new features and fixes. You can follow our guide to upgrade your app to the latest version.

Current version (Stable)

0.50DocumentationRelease Notes

This is the version that is configured automatically when you create a new project using react-native init.

Pre-release versions

masterDocumentation
0.51-RCDocumentationRelease Notes

To see what changes are coming and provide better feedback to React Native contributors, use the latest release candidate when possible. By the time a release candidate is released, the changes it contains will have been shipped in production Facebook apps for over two weeks.

Past versions

0.49DocumentationRelease Notes
0.48DocumentationRelease Notes
0.47DocumentationRelease Notes
0.46DocumentationRelease Notes
0.45DocumentationRelease Notes
0.44DocumentationRelease Notes
0.43DocumentationRelease Notes
0.42DocumentationRelease Notes
0.41DocumentationRelease Notes
0.40DocumentationRelease Notes
0.39DocumentationRelease Notes
0.38DocumentationRelease Notes
0.37DocumentationRelease Notes
0.36DocumentationRelease Notes
0.35DocumentationRelease Notes
0.34DocumentationRelease Notes
0.33DocumentationRelease Notes
0.32DocumentationRelease Notes
0.31DocumentationRelease Notes
0.30DocumentationRelease Notes
0.29DocumentationRelease Notes
0.28DocumentationRelease Notes
0.27DocumentationRelease Notes
0.26DocumentationRelease Notes
0.25DocumentationRelease Notes
0.24DocumentationRelease Notes
0.23DocumentationRelease Notes
0.22DocumentationRelease Notes
0.21DocumentationRelease Notes
0.20DocumentationRelease Notes
0.19DocumentationRelease Notes
0.18DocumentationRelease Notes

You can find past versions of React Native on GitHub. The release notes can be useful if you would like to learn when a specific feature or fix was released.

You can also view the docs for a particular version of React Native by clicking on the Docs link next to the release in this page. You can come back to this page and switch the version of the docs you're reading at any time by clicking on the version number at the top of the page.

React Native Versions

React Native follows a monthly release train. Every month, a new branch created off master enters the Release Candidate phase, and the previous Release Candidate branch is released and considered stable.

If you have an existing project that uses React Native, read the release notes to learn about new features and fixes. You can follow our guide to upgrade your app to the latest version.

Current version (Stable)

0.50DocumentationRelease Notes

This is the version that is configured automatically when you create a new project using react-native init.

Pre-release versions

masterDocumentation
0.51-RCDocumentationRelease Notes

To see what changes are coming and provide better feedback to React Native contributors, use the latest release candidate when possible. By the time a release candidate is released, the changes it contains will have been shipped in production Facebook apps for over two weeks.

Past versions

0.49DocumentationRelease Notes
0.48DocumentationRelease Notes
0.47DocumentationRelease Notes
0.46DocumentationRelease Notes
0.45DocumentationRelease Notes
0.44DocumentationRelease Notes
0.43DocumentationRelease Notes
0.42DocumentationRelease Notes
0.41DocumentationRelease Notes
0.40DocumentationRelease Notes
0.39DocumentationRelease Notes
0.38DocumentationRelease Notes
0.37DocumentationRelease Notes
0.36DocumentationRelease Notes
0.35DocumentationRelease Notes
0.34DocumentationRelease Notes
0.33DocumentationRelease Notes
0.32DocumentationRelease Notes
0.31DocumentationRelease Notes
0.30DocumentationRelease Notes
0.29DocumentationRelease Notes
0.28DocumentationRelease Notes
0.27DocumentationRelease Notes
0.26DocumentationRelease Notes
0.25DocumentationRelease Notes
0.24DocumentationRelease Notes
0.23DocumentationRelease Notes
0.22DocumentationRelease Notes
0.21DocumentationRelease Notes
0.20DocumentationRelease Notes
0.19DocumentationRelease Notes
0.18DocumentationRelease Notes

You can find past versions of React Native on GitHub. The release notes can be useful if you would like to learn when a specific feature or fix was released.

You can also view the docs for a particular version of React Native by clicking on the Docs link next to the release in this page. You can come back to this page and switch the version of the docs you're reading at any time by clicking on the version number at the top of the page.

\ No newline at end of file