From bb39ee0efe5fa4f1dd307d7efbc0d1659da83bfc Mon Sep 17 00:00:00 2001
From: Website Deployment Script Animated focuses on declarative relationships betwe
and outputs, with configurable transforms in between, and simple start/stop
methods to control time-based animation execution. For example, a complete
component with a simple spring bounce on mount looks like this:
Note that in order to get this to work on Android componentWillMount() { // Animate creation LayoutAnimation.spring(); - }, + } _onPress() { // Animate the update @@ -179,7 +179,7 @@ what you want.
Note that in order to get this to work on Android </View> ); } -};
This example uses a preset value, you can customize the animations as +}
This example uses a preset value, you can customize the animations as you need, see LayoutAnimation.js for more information.
requestAnimationFrame is a polyfill from the browser that you might be
familiar with. It accepts a function as its only argument and calls that
diff --git a/releases/next/docs/direct-manipulation.html b/releases/next/docs/direct-manipulation.html
index 029a06fd0a0..41388b60371 100644
--- a/releases/next/docs/direct-manipulation.html
+++ b/releases/next/docs/direct-manipulation.html
@@ -12,7 +12,7 @@ within your React components, which makes your code more difficult to
reason about. Before you use it, try to solve your problem with setState
and shouldComponentUpdate.
TouchableOpacity
uses setNativeProps internally to update the opacity of its child
-component:
Let's imagine that setNativeProps was not available. One way that we
might implement it with that constraint is to store the opacity value
-in the state, then update that value whenever onPress is fired:
onPress is fired:RCTUIManager.updateView
this is the exact same function call that results from re-rendering -
see receiveComponent in
ReactNativeBaseComponent.js.Composite components are not backed by a native view, so you cannot call
-setNativeProps on them. Consider this example:
setNativeProps on them. Consider this example:If you run this you will immediately see this error: Touchable child
+ }
+}
If you run this you will immediately see this error: Touchable child
must either be native or forward setNativeProps to a native component.
This occurs because MyButton isn't directly backed by a native view
whose opacity should be set. You can think about it like this: if you
@@ -77,10 +78,10 @@ pass the style prop down to a child, unless you are wrapping a native
component. Similarly, we are going to forward setNativeProps to a
native-backed child component.
All we need to do is provide a setNativeProps method on our component
that calls setNativeProps on the appropriate child with the given
-arguments.
You can now use MyButton inside of TouchableOpacity! A sidenote for
+ }
+}
You can now use MyButton inside of TouchableOpacity! A sidenote for
clarity: we used the ref callback syntax here, rather than the traditional string-based ref.
You may have noticed that we passed all of the props down to the child
view using {...this.props}. The reason for this is that
TouchableOpacity is actually a composite component, and so in addition
@@ -104,10 +105,15 @@ characters when the bufferDelay is low and the user types very
quickly. Some developers prefer to skip this prop entirely and instead
use setNativeProps to directly manipulate the TextInput value when
necessary. For example, the following code demonstrates clearing the
-input when you tap a button:
If you update a property that is also managed by the render function, +}
If you update a property that is also managed by the render function,
you might end up with some unpredictable and confusing bugs because
anytime the component re-renders and that property changes, whatever
value was previously set from setNativeProps will be completely
diff --git a/releases/next/docs/native-components-android.html b/releases/next/docs/native-components-android.html
index 88bbd3fa674..395036da1f2 100644
--- a/releases/next/docs/native-components-android.html
+++ b/releases/next/docs/native-components-android.html
@@ -58,7 +58,8 @@ module.exports }
The event name topChange maps to the onChange callback prop in JavaScript (mappings are in UIManagerModuleConstants.java). This callback is invoked with the raw event, which we typically process in the wrapper component to make a simpler API: