diff --git a/releases/0.43/docs/flatlist.html b/releases/0.43/docs/flatlist.html index dd10cf944ca..8fd609a957a 100644 --- a/releases/0.43/docs/flatlist.html +++ b/releases/0.43/docs/flatlist.html @@ -89,7 +89,9 @@ class FlatListExample extends } render() { const filterRegex = new RegExp(String(this.state.filterText), 'i'); - const filter = (item) => (filterRegex.test(item.text) || filterRegex.test(item.title)); + const filter = (item) => ( + filterRegex.test(item.text) || filterRegex.test(item.title) + ); const filteredData = this.state.data.filter(filter); return ( <UIExplorerPage @@ -124,9 +126,14 @@ class FlatListExample extends ={filteredData} debug={this.state.debug} disableVirtualization={!this.state.virtualized} - getItemLayout={this.state.fixedHeight ? this._getItemLayout : undefined} + getItemLayout={this.state.fixedHeight ? + this._getItemLayout : + undefined + } horizontal={this.state.horizontal} - key={(this.state.horizontal ? 'h' : 'v') + (this.state.fixedHeight ? 'f' : 'd')} + key={(this.state.horizontal ? 'h' : 'v') + + (this.state.fixedHeight ? 'f' : 'd') + } legacyImplementation={false} numColumns={1} onRefresh={this._onRefresh} @@ -157,22 +164,31 @@ class FlatListExample extends }; _shouldItemUpdate(prev, next) { /** - * Note that this does not check state.horizontal or state.fixedheight because we blow away the - * whole list by changing the key in those cases. Make sure that you do the same in your code, - * or incorporate all relevant data into the item data, or skip this optimization entirely. + * Note that this does not check state.horizontal or state.fixedheight + * because we blow away the whole list by changing the key in those cases. + * Make sure that you do the same in your code, or incorporate all relevant + * data into the item data, or skip this optimization entirely. */ return prev.item !== next.item; } - // This is called when items change viewability by scrolling into or out of the viewable area. + // This is called when items change viewability by scrolling into or out of + // the viewable area. _onViewableItemsChanged = (info: { changed: Array<{ - key: string, isViewable: boolean, item: any, index: ?number, section?: any + key: string, + isViewable: boolean, + item: any, + index: ?number, + section?: any, }> } ) => { // Impressions can be logged here if (this.state.logViewable) { - infoLog('onViewableItemsChanged: ', info.changed.map((v) => ({...v, item: '...'}))); + infoLog( + 'onViewableItemsChanged: ', + info.changed.map((v) => ({...v, item: '...'})), + ); } }; _pressItem = (key: number) => { diff --git a/releases/0.43/docs/scrollview.html b/releases/0.43/docs/scrollview.html index a08d335e5cf..ad5279f57ce 100644 --- a/releases/0.43/docs/scrollview.html +++ b/releases/0.43/docs/scrollview.html @@ -6,17 +6,16 @@ set the height of the view directly (discouraged) or make sure all parent views have bounded height. Forgetting to transfer {flex: 1} down the view stack can lead to errors here, which the element inspector makes easy to debug.

Doesn't yet support other contained responders from blocking this scroll -view from becoming the responder.

<ScrollView> vs <ListView> - which one to use? -ScrollView simply renders all its react child components at once. That -makes it very easy to understand and use. -On the other hand, this has a performance downside. Imagine you have a very -long list of items you want to display, worth of couple of your ScrollView’s -heights. Creating JS components and native views upfront for all its items, -which may not even be shown, will contribute to slow rendering of your -screen and increased memory usage.

This is where ListView comes into play. ListView renders items lazily, -just when they are about to appear. This laziness comes at cost of a more -complicated API, which is worth it unless you are rendering a small fixed -set of items.

Props #

contentContainerStyle?: StyleSheetPropType(ViewStylePropTypes) #

These styles will be applied to the scroll view content container which +view from becoming the responder.

<ScrollView> vs <FlatList> - which one to use?

ScrollView simply renders all its react child components at once. That +makes it very easy to understand and use.

On the other hand, this has a performance downside. Imagine you have a very +long list of items you want to display, maybe several screens worth of +content. Creating JS components and native views for everythign all at once, +much of which may not even be shown, will contribute to slow rendering and +increased memory usage.

This is where FlatList comes into play. FlatList renders items lazily, +just when they are about to appear, and removes items that scroll way off +screen to save memory and processing time.

FlatList is also handy if you want to render separators between your items, +multiple columns, infinite scroll loading, or any number of other features it +supports out of the box.

Props #

contentContainerStyle?: StyleSheetPropType(ViewStylePropTypes) #

These styles will be applied to the scroll view content container which wraps all of the child views. Example:

return ( <ScrollView contentContainerStyle={styles.contentContainer}> </ScrollView> diff --git a/releases/0.43/docs/sectionlist.html b/releases/0.43/docs/sectionlist.html index 1a5bf81e5a7..444f1a1e733 100644 --- a/releases/0.43/docs/sectionlist.html +++ b/releases/0.43/docs/sectionlist.html @@ -87,7 +87,9 @@ class SectionListExample extends }; render() { const filterRegex = new RegExp(String(this.state.filterText), 'i'); - const filter = (item) => (filterRegex.test(item.text) || filterRegex.test(item.title)); + const filter = (item) => ( + filterRegex.test(item.text) || filterRegex.test(item.title) + ); const filteredData = this.state.data.filter(filter); return ( <UIExplorerPage @@ -110,8 +112,12 @@ class SectionListExample extends ={HeaderComponent} ListFooterComponent={FooterComponent} - SectionSeparatorComponent={() => <CustomSeparatorComponent text="SECTION SEPARATOR" />} - ItemSeparatorComponent={() => <CustomSeparatorComponent text="ITEM SEPARATOR" />} + SectionSeparatorComponent={() => + <CustomSeparatorComponent text="SECTION SEPARATOR" /> + } + ItemSeparatorComponent={() => + <CustomSeparatorComponent text="ITEM SEPARATOR" /> + } enableVirtualization={this.state.virtualized} onRefresh={() => alert('onRefresh: nothing to refresh :P')} onViewableItemsChanged={this._onViewableItemsChanged} @@ -123,8 +129,8 @@ class SectionListExample extends {title: 'Item In Header Section', text: 'Section s1', key: '0'}, ]}, {key: 's2', data: [ - {noImage: true, title: 'First item', text: 'Section s2', key: '0'}, - {noImage: true, title: 'Second item', text: 'Section s2', key: '1'}, + {noImage: true, title: '1st item', text: 'Section s2', key: '0'}, + {noImage: true, title: '2nd item', text: 'Section s2', key: '1'}, ]}, {key: 'Filtered Items', data: filteredData}, ]} @@ -133,11 +139,18 @@ class SectionListExample extends /UIExplorerPage> ); } - _renderItemComponent = ({item}) => <ItemComponent item={item} onPress={this._pressItem} />; - // This is called when items change viewability by scrolling into our out of the viewable area. + _renderItemComponent = ({item}) => ( + <ItemComponent item={item} onPress={this._pressItem} /> + ); + // This is called when items change viewability by scrolling into our out of + // the viewable area. _onViewableItemsChanged = (info: { changed: Array<{ - key: string, isViewable: boolean, item: {columns: Array<*>}, index: ?number, section?: any + key: string, + isViewable: boolean, + item: {columns: Array<*>}, + index: ?number, + section?: any }>}, ) => { // Impressions can be logged here diff --git a/releases/0.43/docs/virtualizedlist.html b/releases/0.43/docs/virtualizedlist.html index e3e0788d509..444f03aa270 100644 --- a/releases/0.43/docs/virtualizedlist.html +++ b/releases/0.43/docs/virtualizedlist.html @@ -10,17 +10,29 @@ your data is captured in the item data or external stores like Flux, Redux, or R 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.

  • By default, the list looks for a key prop on each item and uses that for the React key. -Alternatively, you can provide a custom keyExtractor prop.
  • Props #

    FooterComponent?: ?ReactClass<any> #

    HeaderComponent?: ?ReactClass<any> #

    SeparatorComponent?: ?ReactClass<any> #

    data?: any #

    The default accessor functions assume this is an Array<{key: string}> but you can override +Alternatively, you can provide a custom keyExtractor prop.

    NOTE: LayoutAnimation and sticky section headers both have bugs when used with this and are +therefore not officially supported yet.

    NOTE: removeClippedSubviews 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.

    Props #

    FooterComponent?: ?ReactClass<any> #

    HeaderComponent?: ?ReactClass<any> #

    SeparatorComponent?: ?ReactClass<any> #

    data?: any #

    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.

    debug?: ?boolean #

    debug will turn on extra logging and visual overlays to aid with debugging both usage and -implementation.

    disableVirtualization: boolean #

    DEPRECATED: Virtualization provides significant performance and memory optimizations, but fully +implementation, but with a significant perf hit.

    disableVirtualization: boolean #

    DEPRECATED: Virtualization provides significant performance and memory optimizations, but fully unmounts react instances that are outside of the render window. You should only need to disable -this for debugging purposes.

    getItem: (items: any, index: number) => ?Item #

    getItemCount: (items: any) => number #

    getItemLayout?: (items: any, index: number) => - {length: number, offset: number, index: number} #

    horizontal?: ?boolean #

    initialNumToRender: number #

    keyExtractor: (item: Item, index: number) => string #

    maxToRenderPerBatch: number #

    onEndReached?: ?(info: {distanceFromEnd: number}) => void #

    onEndReachedThreshold?: ?number #

    onLayout?: ?Function #

    onRefresh?: ?Function #

    If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make +this for debugging purposes.

    getItem: (data: any, index: number) => ?Item #

    A generic accessor for extracting an item from any sort of data blob.

    getItemCount: (data: any) => number #

    Determines how many items are in the data blob.

    getItemLayout?: (data: any, index: number) => + {length: number, offset: number, index: number} #

    horizontal?: ?boolean #

    initialNumToRender: number #

    How many items to render in the initial batch. This should be enough to fill the screen but not +much more.

    keyExtractor: (item: Item, index: number) => string #

    maxToRenderPerBatch: number #

    The maximum number of items to render in each incremental render batch. The more rendered at +once, the better the fill rate, but responsiveness my suffer because rendering content may +interfere with responding to button taps or other interactions.

    onEndReached?: ?(info: {distanceFromEnd: number}) => void #

    onEndReachedThreshold?: ?number #

    onLayout?: ?Function #

    onRefresh?: ?Function #

    If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make sure to also set the refreshing prop correctly.

    onViewableItemsChanged?: ?(info: {viewableItems: Array<ViewToken>, changed: Array<ViewToken>}) => void #

    Called when the viewability of rows changes, as defined by the -viewabilityConfig prop.

    refreshing?: ?boolean #

    Set this true while waiting for new data from a refresh.

    removeClippedSubviews?: boolean #

    renderItem: (info: {item: Item, index: number}) => ?React.Element<any> #

    renderScrollComponent: (props: Object) => React.Element<any> #

    shouldItemUpdate: ( +viewabilityConfig prop.

    refreshing?: ?boolean #

    Set this true while waiting for new data from a refresh.

    removeClippedSubviews?: boolean #

    A native optimization that removes clipped subviews (those outside the parent) from the view +hierarchy to offload work from the native rendering system. They are still kept around so no +memory is saved and state is preserved.

    renderItem: (info: {item: Item, index: number}) => ?React.Element<any> #

    renderScrollComponent: (props: Object) => React.Element<any> #

    Render a custom scroll component, e.g. with a differently styled RefreshControl.

    shouldItemUpdate: ( props: {item: Item, index: number}, nextProps: {item: Item, index: number} -) => boolean #

    updateCellsBatchingPeriod: number #

    viewabilityConfig?: ViewabilityConfig #

    windowSize: number #

    Methods #

    scrollToEnd(params?: object) #

    scrollToIndex(params: object) #

    scrollToItem(params: object) #

    scrollToOffset(params: object) #

    recordInteraction() #

    Type Definitions #

    Props #

    Type:
    IntersectionTypeAnnotation

    You can edit the content above on GitHub and send us a pull request!

    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.

    Current Version (Stable)

    0.42DocumentationRelease Notes

    This is the version that is configured automatically when you run react-native init. We highly recommend using the current version of React Native when starting a new project.

    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.

    Pre-release Versions

    masterDocumentation
    0.43-RCDocumentationRelease Notes

    For those who live on the bleeding edge. Only recommended if you're actively contributing code to React Native, or if you need to verify how your application behaves in an upcoming release.

    Past Versions

    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.

    Current Version (Stable)

    0.42DocumentationRelease Notes

    This is the version that is configured automatically when you run react-native init. We highly recommend using the current version of React Native when starting a new project.

    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.

    Pre-release Versions

    masterDocumentation
    0.43-RCDocumentationRelease Notes

    For those who live on the bleeding edge. Only recommended if you're actively contributing code to React Native, or if you need to verify how your application behaves in an upcoming release.

    Past Versions

    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