mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Updated docs for next
This commit is contained in:
@@ -101,8 +101,11 @@ of the animations is stopped, they will all be stopped. You can override
|
||||
this with the <code>stopTogether</code> flag.</p></div></div><div class="prop"><h4 class="methodTitle"><a class="anchor" name="stagger"></a><span class="methodType">static </span>stagger<span class="methodType">(time, animations)</span> <a class="hash-link" href="docs/animated.html#stagger">#</a></h4><div><p>Array of animations may run in parallel (overlap), but are started in
|
||||
sequence with successive delays. Nice for doing trailing effects.</p></div></div><div class="prop"><h4 class="methodTitle"><a class="anchor" name="loop"></a><span class="methodType">static </span>loop<span class="methodType">(animation)</span> <a class="hash-link" href="docs/animated.html#loop">#</a></h4><div><p>Loops a given animation continuously, so that each time it reaches the
|
||||
end, it resets and begins again from the start. Can specify number of
|
||||
times to loop using the key 'iterations' in the config. Will loop without
|
||||
blocking the UI thread if the child animation is set to 'useNativeDriver'.</p></div></div><div class="prop"><h4 class="methodTitle"><a class="anchor" name="event"></a><span class="methodType">static </span>event<span class="methodType">(argMapping, config?)</span> <a class="hash-link" href="docs/animated.html#event">#</a></h4><div><p>Takes an array of mappings and extracts values from each arg accordingly,
|
||||
times to loop using the key <code>iterations</code> in the config. Will loop without
|
||||
blocking the UI thread if the child animation is set to <code>useNativeDriver: true</code>.
|
||||
In addition, loops can prevent <code>VirtualizedList</code>-based components from rendering
|
||||
more rows while the animation is running. You can pass <code>isInteraction: false</code> in the
|
||||
child animation config to fix this.</p></div></div><div class="prop"><h4 class="methodTitle"><a class="anchor" name="event"></a><span class="methodType">static </span>event<span class="methodType">(argMapping, config?)</span> <a class="hash-link" href="docs/animated.html#event">#</a></h4><div><p>Takes an array of mappings and extracts values from each arg accordingly,
|
||||
then calls <code>setValue</code> on the mapped outputs. e.g.</p><div class="prism language-javascript"> onScroll<span class="token operator">=</span><span class="token punctuation">{</span>Animated<span class="token punctuation">.</span><span class="token function">event</span><span class="token punctuation">(</span>
|
||||
<span class="token punctuation">[</span><span class="token punctuation">{</span>nativeEvent<span class="token punctuation">:</span> <span class="token punctuation">{</span>contentOffset<span class="token punctuation">:</span> <span class="token punctuation">{</span>x<span class="token punctuation">:</span> <span class="token keyword">this</span><span class="token punctuation">.</span>_scrollX<span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
|
||||
<span class="token punctuation">{</span>listener<span class="token punctuation">:</span> <span class="token punctuation">(</span>event<span class="token punctuation">)</span> <span class="token operator">=></span> console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span>event<span class="token punctuation">)</span><span class="token punctuation">}</span><span class="token punctuation">,</span><span class="token comment" spellcheck="true"> // Optional async listener
|
||||
|
||||
@@ -192,7 +192,7 @@ You can also take a look at the <a href="https://github.com/facebook/react-nativ
|
||||
The main limitation is that you can only animate non-layout properties:
|
||||
things like <code>transform</code> and <code>opacity</code> will work, but flexbox and position properties will not.
|
||||
When using <code>Animated.event</code>, it will only work with direct events and not bubbling events.
|
||||
This means it does not work with <code>PanResponder</code> but does work with things like <code>ScrollView#onScroll</code>.</p><h3><a class="anchor" name="bear-in-mind"></a>Bear in mind <a class="hash-link" href="docs/animations.html#bear-in-mind">#</a></h3><p>While using transform styles such as <code>rotateY</code>, <code>rotateX</code>, and others ensure the transform style <code>perspective</code> is in place.
|
||||
This means it does not work with <code>PanResponder</code> but does work with things like <code>ScrollView#onScroll</code>.</p><p>When an animation is running, it can prevent <code>VirtualizedList</code> components from rendering more rows. If you need to run a long or looping animation while the user is scrolling through a list, you can use <code>isInteraction: false</code> in your animation's config to prevent this issue.</p><h3><a class="anchor" name="bear-in-mind"></a>Bear in mind <a class="hash-link" href="docs/animations.html#bear-in-mind">#</a></h3><p>While using transform styles such as <code>rotateY</code>, <code>rotateX</code>, and others ensure the transform style <code>perspective</code> is in place.
|
||||
At this time some animations may not render on Android without it. Example below.</p><div class="prism language-javascript"><span class="token operator"><</span>Animated<span class="token punctuation">.</span>View
|
||||
style<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">{</span>
|
||||
transform<span class="token punctuation">:</span> <span class="token punctuation">[</span>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -38,12 +38,12 @@ internet connectivity.</p><div class="prism language-javascript">NetInfo<span cl
|
||||
<span class="token keyword">function</span> <span class="token function">handleFirstConnectivityChange</span><span class="token punctuation">(</span>isConnected<span class="token punctuation">)</span> <span class="token punctuation">{</span>
|
||||
console<span class="token punctuation">.</span><span class="token function">log</span><span class="token punctuation">(</span><span class="token string">'Then, is '</span> <span class="token operator">+</span> <span class="token punctuation">(</span>isConnected <span class="token operator">?</span> <span class="token string">'online'</span> <span class="token punctuation">:</span> <span class="token string">'offline'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
NetInfo<span class="token punctuation">.</span>isConnected<span class="token punctuation">.</span><span class="token function">removeEventListener</span><span class="token punctuation">(</span>
|
||||
<span class="token string">'change'</span><span class="token punctuation">,</span>
|
||||
<span class="token string">'connectionChange'</span><span class="token punctuation">,</span>
|
||||
handleFirstConnectivityChange
|
||||
<span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||||
<span class="token punctuation">}</span>
|
||||
NetInfo<span class="token punctuation">.</span>isConnected<span class="token punctuation">.</span><span class="token function">addEventListener</span><span class="token punctuation">(</span>
|
||||
<span class="token string">'change'</span><span class="token punctuation">,</span>
|
||||
<span class="token string">'connectionChange'</span><span class="token punctuation">,</span>
|
||||
handleFirstConnectivityChange
|
||||
<span class="token punctuation">)</span><span class="token punctuation">;</span></div><h3><a class="anchor" name="connectivity-types-deprecated"></a>Connectivity Types (deprecated) <a class="hash-link" href="docs/netinfo.html#connectivity-types-deprecated">#</a></h3><p>The following connectivity types are deprecated. They're used by the deprecated APIs <code>fetch</code> and the <code>change</code> event.</p><p>iOS connectivity types (deprecated):
|
||||
- <code>none</code> - device is offline
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user