From 3dd5bc230b0eeb3d5bafbc89e4c3a0b879bac2b4 Mon Sep 17 00:00:00 2001 From: Website Deployment Script Date: Tue, 18 Jun 2019 01:27:59 +0000 Subject: [PATCH] Deploy website Deploy website version based on bfb715698c5027ce91946d725d36b101a512db97 --- .../optimizing-flatlist-configuration.html | 43 ++++++++++--------- .../index.html | 43 ++++++++++--------- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/docs/next/optimizing-flatlist-configuration.html b/docs/next/optimizing-flatlist-configuration.html index a46fd8b97e6..23cd1b23081 100644 --- a/docs/next/optimizing-flatlist-configuration.html +++ b/docs/next/optimizing-flatlist-configuration.html @@ -75,11 +75,12 @@
  • VirtualizedList: The component behind FlatList (React Native's implementation of the 'Virtual List' concept.)

  • Memory consumption: How much information about your list is being stored in memory, which could lead to a app crash.

  • Responsiveness: Application ability to respond to interactions. Low responsiveness, for instance, is when you touch on a component and it waits a bit to respond, instead of responding immediately as expected.

  • -
  • Blank areas: When VirtualizedList couldn't render your items fast enough, you enter on a part of your list with non rendered components.

  • -
  • Window: The viewport (the area size in which items should be rendered).

  • +
  • Blank areas: When VirtualizedList can't render your items fast enough, you may enter a part of your list with non-rendered components that appear as blank white space.

  • +
  • Viewport: The visible area of content that is rendered to pixels.

  • +
  • Window: The area in which items should be mounted, which is generally much larger than the viewport.

  • Props

    -

    Here are a list of props that can help to improve the FlatList:

    +

    Here are a list of props that can help to improve FlatList performance:

    removeClippedSubviews

    @@ -89,9 +90,9 @@
    BooleanFalse
    -

    If true, unmount components that are off of the window.

    -

    Pros: This is very memory friendly, as you will always have a little amount of rendered items instead of the whole list.

    -

    Cons: Be aware that this implementation can have bugs, such as missing content (mainly observed on iOS) if you use it on a component that will not unmount (such as a root navigation scene). It also can be less performant, having choppy scroll animations for big lists with complex items on old devices, as it makes complicated calculations per scroll.

    +

    If true, views that are outside of the viewport are detached from the native view hierarchy.

    +

    Pros: This reduces time spent on the main thread, and thus reduces the risk of dropped frames, by excluding views outside of the viewport from the native rendering and drawing traversals.

    +

    Cons: Be aware that this implementation can have bugs, such as missing content (mainly observed on iOS), especially if you are doing complex things with transforms and/or absolute positioning. Also note this does not save significant memory because the views are not deallocated, just detached.

    maxToRenderPerBatch

    @@ -101,9 +102,9 @@
    Number10
    -

    It is a VirtualizedList prop that can be passed directly to FlatList. Control the amount of items rendered per batch, which is the next chunk of items rendered on every scroll.

    -

    Pros: Setting a bigger number means less visual blank areas when scrolling (a better the fill rate).

    -

    Cons: More items per batch means less javascript performance, which means less responsiveness (clicking a item and opening the detail). If you have a static and non-interactive list, this could be the way to go.

    +

    It is a VirtualizedList prop that can be passed through FlatList. This controls the amount of items rendered per batch, which is the next chunk of items rendered on every scroll.

    +

    Pros: Setting a bigger number means less visual blank areas when scrolling (increases the fill rate).

    +

    Cons: More items per batch means longer periods of JavaScript execution potentially blocking other event processing, like presses, hurting responsiveness.

    updateCellsBatchingPeriod

    @@ -113,9 +114,9 @@
    Number50
    -

    While maxToRenderPerBatch tells the amount of items rendered per batch, setting updateCellsBatchingPeriod tells to your VirtualizedList the delay in milliseconds between batch renders (how frequently your component will be rendering the windowed items).

    +

    While maxToRenderPerBatch tells the amount of items rendered per batch, setting updateCellsBatchingPeriod tells your VirtualizedList the delay in milliseconds between batch renders (how frequently your component will be rendering the windowed items).

    Pros: Combining this prop with maxToRenderPerBatch gives you the power to, for example, render more items in a less frequent batch, or less items in a more frequent batch.

    -

    Cons: Less frequent batches may cause blank areas, More frequent batches may cause responsiveness and performance loss.

    +

    Cons: Less frequent batches may cause blank areas, More frequent batches may cause responsiveness issues.

    initialNumToRender

    @@ -126,8 +127,8 @@

    The initial amount of items to render.

    -

    Pros: Define precise number of items that would cover the screen for every device. This can be a big performance boost when rendering the list component.

    -

    Cons: Setting a low initialNumToRender may cause to see blank areas.

    +

    Pros: Define precise number of items that would cover the screen for every device. This can be a big performance boost for the initial render.

    +

    Cons: Setting a low initialNumToRender may cause blank areas, especially if it's too small to cover the viewport on initial render.

    windowSize

    @@ -138,8 +139,8 @@

    The number passed here is a measurement unit where 1 is equivalent to your viewport height. The default value is 21 (10 viewports above, 10 below, and one in between).

    -

    Pros: Bigger windowSize will result in less blank space while scrolling (more performance). On the other hand, Smaller windowSize will result in to render smaller list (less memory consumption).

    -

    Cons: For a bigger windowSize, you will have a bigger memory consumption. For a lower windowSize, you will have lower performance and bigger chance of seeing blank areas.

    +

    Pros: Bigger windowSize will result in less chance of seeing blank space while scrolling. On the other hand, smaller windowSize will result in fewer items mounted simultaneously, saving memory.

    +

    Cons: For a bigger windowSize, you will have more memory consumption. For a lower windowSize, you will have a bigger chance of seeing blank areas.

    legacyImplementation

    @@ -149,13 +150,13 @@
    BooleanFalse
    -

    Make FlatList rely on the older ListView instead of VirtualizedList.

    -

    Pros: This will make your list definitely perform better, as it removes virtualization and render all your items at once.

    -

    Cons: Extra memory consumption and more app crash risk in large lists (100+) with complex items. It also warns that the above tweaks will not work because now it is using ListView.

    +

    Make FlatList rely on the older and deprecated ListView instead of VirtualizedList.

    +

    Pros: No risk of seeing blank areas while scrolling. May avoid bugs in VirtualizedList.

    +

    Cons: Extra memory consumption and more app crash risk in large lists (100+) with complex items. It also warns that the above tweaks will not work because now it is using ListView. Many other features are not supported. There may be other bugs since ListView is deprecated.

    List items

    -

    There are also some tips about list item components. They are being managed by VirtualizedList a lot, so they need to be fast.

    +

    Below are some tips about list item components. They are the core of your list, so they need to be fast.

    Use simple components

    -

    The more complex your components are, the slower they will render. Try to avoid a lot of logic and nesting in your list items. If you are reusing this list item component a lot in your app, create a component just for your big lists and make them with less logic and less nested as possible.

    +

    The more complex your components are, the slower they will render. Try to avoid a lot of logic and nesting in your list items. If you are reusing this list item component a lot in your app, create a component just for your big lists and make them with as little logic and nesting as possible.

    Use light components

    The heavier your components are, the slower they render. Avoid heavy images (use a cropped version or thumbnail for list items, as small as possible). Talk to your design team, use as little effects and interactions and information as possible in your list. Show them in your item's detail.

    Use shouldComponentUpdate

    @@ -167,7 +168,7 @@

    Use cached optimized images

    You can use the community packages (such as react-native-fast-image from @DylanVann) for more performant images. Every image in your list is a new Image() instance. The faster it reaches the loaded hook, the faster your Javascript thread will be free again.

    Use getItemLayout

    -

    If all your list item components have the same height (or width, for a horizontal list), passing getItemLayout prop removes the need for your FlatList to dynamically calculate it every time. This is a very desirable optimization technique.

    +

    If all your list item components have the same height (or width, for a horizontal list), providing the getItemLayout prop removes the need for your FlatList to manage async layout calculations. This is a very desirable optimization technique.

    If your components have dynamic size and you really need performance, consider asking your design team if they may think of a redesign in order to perform better.

    Use keyExtractor or key

    You can set the keyExtractor to your FlatList component. This prop is used for caching and as the React key to track item re-ordering.

    diff --git a/docs/next/optimizing-flatlist-configuration/index.html b/docs/next/optimizing-flatlist-configuration/index.html index a46fd8b97e6..23cd1b23081 100644 --- a/docs/next/optimizing-flatlist-configuration/index.html +++ b/docs/next/optimizing-flatlist-configuration/index.html @@ -75,11 +75,12 @@
  • VirtualizedList: The component behind FlatList (React Native's implementation of the 'Virtual List' concept.)

  • Memory consumption: How much information about your list is being stored in memory, which could lead to a app crash.

  • Responsiveness: Application ability to respond to interactions. Low responsiveness, for instance, is when you touch on a component and it waits a bit to respond, instead of responding immediately as expected.

  • -
  • Blank areas: When VirtualizedList couldn't render your items fast enough, you enter on a part of your list with non rendered components.

  • -
  • Window: The viewport (the area size in which items should be rendered).

  • +
  • Blank areas: When VirtualizedList can't render your items fast enough, you may enter a part of your list with non-rendered components that appear as blank white space.

  • +
  • Viewport: The visible area of content that is rendered to pixels.

  • +
  • Window: The area in which items should be mounted, which is generally much larger than the viewport.

  • Props

    -

    Here are a list of props that can help to improve the FlatList:

    +

    Here are a list of props that can help to improve FlatList performance:

    removeClippedSubviews

    @@ -89,9 +90,9 @@
    BooleanFalse
    -

    If true, unmount components that are off of the window.

    -

    Pros: This is very memory friendly, as you will always have a little amount of rendered items instead of the whole list.

    -

    Cons: Be aware that this implementation can have bugs, such as missing content (mainly observed on iOS) if you use it on a component that will not unmount (such as a root navigation scene). It also can be less performant, having choppy scroll animations for big lists with complex items on old devices, as it makes complicated calculations per scroll.

    +

    If true, views that are outside of the viewport are detached from the native view hierarchy.

    +

    Pros: This reduces time spent on the main thread, and thus reduces the risk of dropped frames, by excluding views outside of the viewport from the native rendering and drawing traversals.

    +

    Cons: Be aware that this implementation can have bugs, such as missing content (mainly observed on iOS), especially if you are doing complex things with transforms and/or absolute positioning. Also note this does not save significant memory because the views are not deallocated, just detached.

    maxToRenderPerBatch

    @@ -101,9 +102,9 @@
    Number10
    -

    It is a VirtualizedList prop that can be passed directly to FlatList. Control the amount of items rendered per batch, which is the next chunk of items rendered on every scroll.

    -

    Pros: Setting a bigger number means less visual blank areas when scrolling (a better the fill rate).

    -

    Cons: More items per batch means less javascript performance, which means less responsiveness (clicking a item and opening the detail). If you have a static and non-interactive list, this could be the way to go.

    +

    It is a VirtualizedList prop that can be passed through FlatList. This controls the amount of items rendered per batch, which is the next chunk of items rendered on every scroll.

    +

    Pros: Setting a bigger number means less visual blank areas when scrolling (increases the fill rate).

    +

    Cons: More items per batch means longer periods of JavaScript execution potentially blocking other event processing, like presses, hurting responsiveness.

    updateCellsBatchingPeriod

    @@ -113,9 +114,9 @@
    Number50
    -

    While maxToRenderPerBatch tells the amount of items rendered per batch, setting updateCellsBatchingPeriod tells to your VirtualizedList the delay in milliseconds between batch renders (how frequently your component will be rendering the windowed items).

    +

    While maxToRenderPerBatch tells the amount of items rendered per batch, setting updateCellsBatchingPeriod tells your VirtualizedList the delay in milliseconds between batch renders (how frequently your component will be rendering the windowed items).

    Pros: Combining this prop with maxToRenderPerBatch gives you the power to, for example, render more items in a less frequent batch, or less items in a more frequent batch.

    -

    Cons: Less frequent batches may cause blank areas, More frequent batches may cause responsiveness and performance loss.

    +

    Cons: Less frequent batches may cause blank areas, More frequent batches may cause responsiveness issues.

    initialNumToRender

    @@ -126,8 +127,8 @@

    The initial amount of items to render.

    -

    Pros: Define precise number of items that would cover the screen for every device. This can be a big performance boost when rendering the list component.

    -

    Cons: Setting a low initialNumToRender may cause to see blank areas.

    +

    Pros: Define precise number of items that would cover the screen for every device. This can be a big performance boost for the initial render.

    +

    Cons: Setting a low initialNumToRender may cause blank areas, especially if it's too small to cover the viewport on initial render.

    windowSize

    @@ -138,8 +139,8 @@

    The number passed here is a measurement unit where 1 is equivalent to your viewport height. The default value is 21 (10 viewports above, 10 below, and one in between).

    -

    Pros: Bigger windowSize will result in less blank space while scrolling (more performance). On the other hand, Smaller windowSize will result in to render smaller list (less memory consumption).

    -

    Cons: For a bigger windowSize, you will have a bigger memory consumption. For a lower windowSize, you will have lower performance and bigger chance of seeing blank areas.

    +

    Pros: Bigger windowSize will result in less chance of seeing blank space while scrolling. On the other hand, smaller windowSize will result in fewer items mounted simultaneously, saving memory.

    +

    Cons: For a bigger windowSize, you will have more memory consumption. For a lower windowSize, you will have a bigger chance of seeing blank areas.

    legacyImplementation

    @@ -149,13 +150,13 @@
    BooleanFalse
    -

    Make FlatList rely on the older ListView instead of VirtualizedList.

    -

    Pros: This will make your list definitely perform better, as it removes virtualization and render all your items at once.

    -

    Cons: Extra memory consumption and more app crash risk in large lists (100+) with complex items. It also warns that the above tweaks will not work because now it is using ListView.

    +

    Make FlatList rely on the older and deprecated ListView instead of VirtualizedList.

    +

    Pros: No risk of seeing blank areas while scrolling. May avoid bugs in VirtualizedList.

    +

    Cons: Extra memory consumption and more app crash risk in large lists (100+) with complex items. It also warns that the above tweaks will not work because now it is using ListView. Many other features are not supported. There may be other bugs since ListView is deprecated.

    List items

    -

    There are also some tips about list item components. They are being managed by VirtualizedList a lot, so they need to be fast.

    +

    Below are some tips about list item components. They are the core of your list, so they need to be fast.

    Use simple components

    -

    The more complex your components are, the slower they will render. Try to avoid a lot of logic and nesting in your list items. If you are reusing this list item component a lot in your app, create a component just for your big lists and make them with less logic and less nested as possible.

    +

    The more complex your components are, the slower they will render. Try to avoid a lot of logic and nesting in your list items. If you are reusing this list item component a lot in your app, create a component just for your big lists and make them with as little logic and nesting as possible.

    Use light components

    The heavier your components are, the slower they render. Avoid heavy images (use a cropped version or thumbnail for list items, as small as possible). Talk to your design team, use as little effects and interactions and information as possible in your list. Show them in your item's detail.

    Use shouldComponentUpdate

    @@ -167,7 +168,7 @@

    Use cached optimized images

    You can use the community packages (such as react-native-fast-image from @DylanVann) for more performant images. Every image in your list is a new Image() instance. The faster it reaches the loaded hook, the faster your Javascript thread will be free again.

    Use getItemLayout

    -

    If all your list item components have the same height (or width, for a horizontal list), passing getItemLayout prop removes the need for your FlatList to dynamically calculate it every time. This is a very desirable optimization technique.

    +

    If all your list item components have the same height (or width, for a horizontal list), providing the getItemLayout prop removes the need for your FlatList to manage async layout calculations. This is a very desirable optimization technique.

    If your components have dynamic size and you really need performance, consider asking your design team if they may think of a redesign in order to perform better.

    Use keyExtractor or key

    You can set the keyExtractor to your FlatList component. This prop is used for caching and as the React key to track item re-ordering.