From a0a7d97c7b26aaccd07e1481e58182e00c0cbcbb Mon Sep 17 00:00:00 2001 From: Kexi Long Date: Thu, 8 Jun 2017 12:29:29 -0700 Subject: [PATCH] Exposed progressViewOffset to VirtualizedList and FlatList Reviewed By: sahrens Differential Revision: D5204107 fbshipit-source-id: df2928830f84ea012d532f24c776dee8d2b96989 --- Libraries/Lists/FlatList.js | 7 ++++++- Libraries/Lists/VirtualizedList.js | 11 +++++++++-- .../__tests__/__snapshots__/FlatList-test.js.snap | 1 + .../__tests__/__snapshots__/SectionList-test.js.snap | 1 + .../__snapshots__/VirtualizedList-test.js.snap | 1 + 5 files changed, 18 insertions(+), 3 deletions(-) diff --git a/Libraries/Lists/FlatList.js b/Libraries/Lists/FlatList.js index 546c53eb8..f3dcfeb11 100644 --- a/Libraries/Lists/FlatList.js +++ b/Libraries/Lists/FlatList.js @@ -163,6 +163,11 @@ type OptionalProps = { viewableItems: Array, changed: Array, }) => void, + /** + * Set this when offset is needed for the loading indicator to show correctly. + * @platform android + */ + progressViewOffset?: number, legacyImplementation?: ?boolean, /** * Set this true while waiting for new data from a refresh. @@ -326,7 +331,7 @@ class FlatList extends React.PureComponent, vo /** * Scroll to a specific content pixel offset in the list. - * + * * Check out [scrollToOffset](docs/virtualizedlist.html#scrolltooffset) of VirtualizedList */ scrollToOffset(params: {animated?: ?boolean, offset: number}) { diff --git a/Libraries/Lists/VirtualizedList.js b/Libraries/Lists/VirtualizedList.js index 211e57c57..b529e6f3b 100644 --- a/Libraries/Lists/VirtualizedList.js +++ b/Libraries/Lists/VirtualizedList.js @@ -121,6 +121,11 @@ type OptionalProps = { viewableItems: Array, changed: Array, }) => void, + /** + * Set this when offset is needed for the loading indicator to show correctly. + * @platform android + */ + progressViewOffset?: number, /** * Set this true while waiting for new data from a refresh. */ @@ -240,11 +245,11 @@ class VirtualizedList extends React.PureComponent { /** * Scroll to a specific content pixel offset in the list. - * + * * Param `offset` expects the offset to scroll to. * In case of `horizontal` is true, the offset is the x-value, * in any other case the offset is the y-value. - * + * * Param `animated` (`true` by default) defines whether the list * should do an animation while scrolling. */ @@ -303,6 +308,7 @@ class VirtualizedList extends React.PureComponent { '`refreshing` prop must be set as a boolean in order to use `onRefresh`, but got `' + JSON.stringify(props.refreshing) + '`', ); + return ( { } /> diff --git a/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap b/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap index 9a5fda521..7c41e3258 100644 --- a/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap +++ b/Libraries/Lists/__tests__/__snapshots__/FlatList-test.js.snap @@ -46,6 +46,7 @@ exports[`FlatList renders all the bells and whistles 1`] = ` refreshControl={ } diff --git a/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap b/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap index c73a90843..90077e007 100644 --- a/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap +++ b/Libraries/Lists/__tests__/__snapshots__/SectionList-test.js.snap @@ -281,6 +281,7 @@ exports[`SectionList renders all the bells and whistles 1`] = ` refreshControl={ } diff --git a/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap b/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap index c769710a4..be39cd2e3 100644 --- a/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap +++ b/Libraries/Lists/__tests__/__snapshots__/VirtualizedList-test.js.snap @@ -282,6 +282,7 @@ exports[`VirtualizedList renders all the bells and whistles 1`] = ` refreshControl={ }