Document ListView.DataSource #410

Summary:Fixes #410
Closes https://github.com/facebook/react-native/pull/7193

Differential Revision: D3217718

fb-gh-sync-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
fbshipit-source-id: c05c9e3d67863c064f8e1102090614c6ba7e3127
This commit is contained in:
Mike Grabowski 2016-04-24 08:12:28 -07:00 committed by Facebook Github Bot 5
parent 3f1165dfc6
commit 7102fd079a
2 changed files with 14 additions and 10 deletions

View File

@ -56,10 +56,10 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
/** /**
* ListView - A core component designed for efficient display of vertically * ListView - A core component designed for efficient display of vertically
* scrolling lists of changing data. The minimal API is to create a * scrolling lists of changing data. The minimal API is to create a
* `ListView.DataSource`, populate it with a simple array of data blobs, and * [`ListView.DataSource`](docs/listviewdatasource.html), populate it with a simple
* instantiate a `ListView` component with that data source and a `renderRow` * array of data blobs, and instantiate a `ListView` component with that data
* callback which takes a blob from the data array and returns a renderable * source and a `renderRow` callback which takes a blob from the data array and
* component. * returns a renderable component.
* *
* Minimal example: * Minimal example:
* *
@ -117,7 +117,9 @@ var ListView = React.createClass({
*/ */
propTypes: { propTypes: {
...ScrollView.propTypes, ...ScrollView.propTypes,
/**
* An instance of [ListView.DataSource](docs/listviewdatasource.html) to use
*/
dataSource: PropTypes.instanceOf(ListViewDataSource).isRequired, dataSource: PropTypes.instanceOf(ListViewDataSource).isRequired,
/** /**
* (sectionID, rowID, adjacentRowHighlighted) => renderable * (sectionID, rowID, adjacentRowHighlighted) => renderable

View File

@ -107,12 +107,13 @@ function isRunnable(componentName, componentPlatform) {
// Hide a component from the sidebar by making it return false from // Hide a component from the sidebar by making it return false from
// this function // this function
function shouldDisplayInSidebar(componentName) { var HIDDEN_COMPONENTS = [
if (componentName === 'Transforms') { 'Transforms',
return false; 'ListViewDataSource',
} ];
return true; function shouldDisplayInSidebar(componentName) {
return HIDDEN_COMPONENTS.indexOf(componentName) === -1;
} }
function getNextComponent(i) { function getNextComponent(i) {
@ -271,6 +272,7 @@ var apis = [
'../Libraries/LayoutAnimation/LayoutAnimation.js', '../Libraries/LayoutAnimation/LayoutAnimation.js',
'../Libraries/Linking/Linking.js', '../Libraries/Linking/Linking.js',
'../Libraries/LinkingIOS/LinkingIOS.js', '../Libraries/LinkingIOS/LinkingIOS.js',
'../Libraries/CustomComponents/ListView/ListViewDataSource.js',
'../node_modules/react/lib/NativeMethodsMixin.js', '../node_modules/react/lib/NativeMethodsMixin.js',
'../Libraries/Network/NetInfo.js', '../Libraries/Network/NetInfo.js',
'../node_modules/react/lib/PanResponder.js', '../node_modules/react/lib/PanResponder.js',