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:
File diff suppressed because one or more lines are too long
@@ -3,11 +3,14 @@
|
||||
renderItem<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">(</span><span class="token punctuation">{</span>item<span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <Text<span class="token operator">></span><span class="token punctuation">{</span>item<span class="token punctuation">.</span>key<span class="token punctuation">}</span><<span class="token operator">/</span>Text<span class="token operator">></span><span class="token punctuation">}</span>
|
||||
<span class="token operator">/</span><span class="token operator">></span></div><p>This is a convenience wrapper around <a href="/react-native/docs/virtualizedlist.html" target=""><code><VirtualizedList></code></a>,
|
||||
and thus inherits the following caveats:</p><ul><li>Internal state is not preserved when content scrolls out of the render window. Make sure all
|
||||
your data is captured in the item data or external stores like Flux, Redux, or Relay.</li><li>In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
||||
your data is captured in the item data or external stores like Flux, Redux, or Relay.</li><li>This is a <code>PureComponent</code> which means that it will not re-render if <code>props</code> remain shallow-
|
||||
equal. Make sure that everything your <code>renderItem</code> function depends on is passed as a prop that
|
||||
is not <code>===</code> after updates, otherwise your UI may not update on changes. This includes the
|
||||
<code>data</code> prop and parent component state.</li><li>In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
||||
offscreen. This means it's possible to scroll faster than the fill rate ands momentarily see
|
||||
blank content. This is a tradeoff that can be adjusted to suit the needs of each application,
|
||||
and we are working on improving it behind the scenes.</li><li>By default, the list looks for a <code>key</code> prop on each item and uses that for the React key.
|
||||
Alternatively, you can provide a custom keyExtractor prop.</li></ul></div><h3><a class="anchor" name="props"></a>Props <a class="hash-link" href="docs/flatlist.html#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="footercomponent"></a>FooterComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/flatlist.html#footercomponent">#</a></h4><div><p>Rendered at the bottom of all the items.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="headercomponent"></a>HeaderComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/flatlist.html#headercomponent">#</a></h4><div><p>Rendered at the top of all the items.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="separatorcomponent"></a>SeparatorComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/flatlist.html#separatorcomponent">#</a></h4><div><p>Rendered in between each item, but not at the top or bottom.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="columnwrapperstyle"></a>columnWrapperStyle?: <span class="propType"><code>StyleObj</code></span> <a class="hash-link" href="docs/flatlist.html#columnwrapperstyle">#</a></h4><div><p>Optional custom style for multi-item rows generated when numColumns > 1</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="data"></a>data: <span class="propType"><code>?Array<ItemT></code></span> <a class="hash-link" href="docs/flatlist.html#data">#</a></h4><div><p>For simplicity, data is just a plain array. If you want to use something else, like an
|
||||
Alternatively, you can provide a custom <code>keyExtractor</code> prop.</li></ul></div><h3><a class="anchor" name="props"></a>Props <a class="hash-link" href="docs/flatlist.html#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="footercomponent"></a>FooterComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/flatlist.html#footercomponent">#</a></h4><div><p>Rendered at the bottom of all the items.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="headercomponent"></a>HeaderComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/flatlist.html#headercomponent">#</a></h4><div><p>Rendered at the top of all the items.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="separatorcomponent"></a>SeparatorComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/flatlist.html#separatorcomponent">#</a></h4><div><p>Rendered in between each item, but not at the top or bottom.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="columnwrapperstyle"></a>columnWrapperStyle?: <span class="propType"><code>StyleObj</code></span> <a class="hash-link" href="docs/flatlist.html#columnwrapperstyle">#</a></h4><div><p>Optional custom style for multi-item rows generated when numColumns > 1</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="data"></a>data: <span class="propType"><code>?Array<ItemT></code></span> <a class="hash-link" href="docs/flatlist.html#data">#</a></h4><div><p>For simplicity, data is just a plain array. If you want to use something else, like an
|
||||
immutable list, use the underlying <code>VirtualizedList</code> directly.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="getitem"></a>getItem?: <a class="hash-link" href="docs/flatlist.html#getitem">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="getitemcount"></a>getItemCount?: <a class="hash-link" href="docs/flatlist.html#getitemcount">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="getitemlayout"></a>getItemLayout?: <span class="propType"><code>(data: ?Array<ItemT>, index: number) =>
|
||||
{length: number, offset: number, index: number}</code></span> <a class="hash-link" href="docs/flatlist.html#getitemlayout">#</a></h4><div><p><code>getItemLayout</code> is an optional optimizations that let us skip measurement of dynamic content if
|
||||
you know the height of items a priori. <code>getItemLayout</code> is the most efficient, and is easy to
|
||||
|
||||
@@ -16,11 +16,14 @@
|
||||
<span class="token punctuation">]</span><span class="token punctuation">}</span>
|
||||
<span class="token operator">/</span><span class="token operator">></span></div><p>This is a convenience wrapper around <a href="/react-native/docs/virtualizedlist.html" target=""><code><VirtualizedList></code></a>,
|
||||
and thus inherits the following caveats:</p><ul><li>Internal state is not preserved when content scrolls out of the render window. Make sure all
|
||||
your data is captured in the item data or external stores like Flux, Redux, or Relay.</li><li>In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
||||
your data is captured in the item data or external stores like Flux, Redux, or Relay.</li><li>This is a <code>PureComponent</code> which means that it will not re-render if <code>props</code> remain shallow-
|
||||
equal. Make sure that everything your <code>renderItem</code> function depends on is passed as a prop that
|
||||
is not <code>===</code> after updates, otherwise your UI may not update on changes. This includes the
|
||||
<code>data</code> prop and parent component state.</li><li>In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
||||
offscreen. This means it's possible to scroll faster than the fill rate ands momentarily see
|
||||
blank content. This is a tradeoff that can be adjusted to suit the needs of each application,
|
||||
and we are working on improving it behind the scenes.</li><li>By default, the list looks for a <code>key</code> prop on each item and uses that for the React key.
|
||||
Alternatively, you can provide a custom keyExtractor prop.</li></ul></div><h3><a class="anchor" name="props"></a>Props <a class="hash-link" href="docs/sectionlist.html#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="itemseparatorcomponent"></a>ItemSeparatorComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#itemseparatorcomponent">#</a></h4><div><p>Rendered in between adjacent Items within each section.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="listfootercomponent"></a>ListFooterComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#listfootercomponent">#</a></h4><div><p>Rendered at the very end of the list.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="listheadercomponent"></a>ListHeaderComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#listheadercomponent">#</a></h4><div><p>Rendered at the very beginning of the list.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="sectionseparatorcomponent"></a>SectionSeparatorComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#sectionseparatorcomponent">#</a></h4><div><p>Rendered in between each section.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="keyextractor"></a>keyExtractor: <span class="propType"><code>(item: Item, index: number) => string</code></span> <a class="hash-link" href="docs/sectionlist.html#keyextractor">#</a></h4><div><p>Used to extract a unique key for a given item at the specified index. Key is used for caching
|
||||
Alternatively, you can provide a custom <code>keyExtractor</code> prop.</li></ul></div><h3><a class="anchor" name="props"></a>Props <a class="hash-link" href="docs/sectionlist.html#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="itemseparatorcomponent"></a>ItemSeparatorComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#itemseparatorcomponent">#</a></h4><div><p>Rendered in between adjacent Items within each section.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="listfootercomponent"></a>ListFooterComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#listfootercomponent">#</a></h4><div><p>Rendered at the very end of the list.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="listheadercomponent"></a>ListHeaderComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#listheadercomponent">#</a></h4><div><p>Rendered at the very beginning of the list.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="sectionseparatorcomponent"></a>SectionSeparatorComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/sectionlist.html#sectionseparatorcomponent">#</a></h4><div><p>Rendered in between each section.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="keyextractor"></a>keyExtractor: <span class="propType"><code>(item: Item, index: number) => string</code></span> <a class="hash-link" href="docs/sectionlist.html#keyextractor">#</a></h4><div><p>Used to extract a unique key for a given item at the specified index. Key is used for caching
|
||||
and as the react key to track item re-ordering. The default extractor checks item.key, then
|
||||
falls back to using the index, like react does.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onendreached"></a>onEndReached?: <span class="propType"><code>?(info: {distanceFromEnd: number}) => void</code></span> <a class="hash-link" href="docs/sectionlist.html#onendreached">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onrefresh"></a>onRefresh?: <span class="propType"><code>?() => void</code></span> <a class="hash-link" href="docs/sectionlist.html#onrefresh">#</a></h4><div><p>If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make
|
||||
sure to also set the <code>refreshing</code> prop correctly.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="onviewableitemschanged"></a>onViewableItemsChanged?: <span class="propType"><code>?(info: {viewableItems: Array<ViewToken>, changed: Array<ViewToken>}) => void</code></span> <a class="hash-link" href="docs/sectionlist.html#onviewableitemschanged">#</a></h4><div><p>Called when the viewability of rows changes, as defined by the
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -6,11 +6,14 @@ maintaining a finite render window of active items and replacing all items outsi
|
||||
window with appropriately sized blank space. The window adapts to scrolling behavior, and items
|
||||
are rendered incrementally with low-pri (after any running interactions) if they are far from the
|
||||
visible area, or with hi-pri otherwise to minimize the potential of seeing blank space.</p><p>Some caveats:</p><ul><li>Internal state is not preserved when content scrolls out of the render window. Make sure all
|
||||
your data is captured in the item data or external stores like Flux, Redux, or Relay.</li><li>In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
||||
your data is captured in the item data or external stores like Flux, Redux, or Relay.</li><li>This is a <code>PureComponent</code> which means that it will not re-render if <code>props</code> remain shallow-
|
||||
equal. Make sure that everything your <code>renderItem</code> function depends on is passed as a prop that
|
||||
is not <code>===</code> after updates, otherwise your UI may not update on changes. This includes the
|
||||
<code>data</code> prop and parent component state.</li><li>In order to constrain memory and enable smooth scrolling, content is rendered asynchronously
|
||||
offscreen. This means it's possible to scroll faster than the fill rate ands momentarily see
|
||||
blank content. This is a tradeoff that can be adjusted to suit the needs of each application,
|
||||
and we are working on improving it behind the scenes.</li><li>By default, the list looks for a <code>key</code> prop on each item and uses that for the React key.
|
||||
Alternatively, you can provide a custom keyExtractor prop.</li></ul><p>NOTE: <code>LayoutAnimation</code> and sticky section headers both have bugs when used with this and are
|
||||
Alternatively, you can provide a custom <code>keyExtractor</code> prop.</li></ul><p>NOTE: <code>LayoutAnimation</code> and sticky section headers both have bugs when used with this and are
|
||||
therefore not officially supported yet.</p><p>NOTE: <code>removeClippedSubviews</code> might not be necessary and may cause bugs. If you see issues with
|
||||
content not rendering, try disabling it, and we may change the default there.</p></div><h3><a class="anchor" name="props"></a>Props <a class="hash-link" href="docs/virtualizedlist.html#props">#</a></h3><div class="props"><div class="prop"><h4 class="propTitle"><a class="anchor" name="footercomponent"></a>FooterComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/virtualizedlist.html#footercomponent">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="headercomponent"></a>HeaderComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/virtualizedlist.html#headercomponent">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="separatorcomponent"></a>SeparatorComponent?: <span class="propType"><code>?ReactClass<any></code></span> <a class="hash-link" href="docs/virtualizedlist.html#separatorcomponent">#</a></h4></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="data"></a>data?: <span class="propType"><code>any</code></span> <a class="hash-link" href="docs/virtualizedlist.html#data">#</a></h4><div><p>The default accessor functions assume this is an Array<{key: string}> but you can override
|
||||
getItem, getItemCount, and keyExtractor to handle any type of index-based data.</p></div></div><div class="prop"><h4 class="propTitle"><a class="anchor" name="debug"></a>debug?: <span class="propType"><code>?boolean</code></span> <a class="hash-link" href="docs/virtualizedlist.html#debug">#</a></h4><div><p><code>debug</code> will turn on extra logging and visual overlays to aid with debugging both usage and
|
||||
|
||||
Reference in New Issue
Block a user