Permalink
Browse files

use $ReadOnlyArray for section stuff

Reviewed By: kassens

Differential Revision: D4983581

fbshipit-source-id: 7951b6d225aee62932ac12047afb89a34fc58722
  • Loading branch information...
sahrens authored and facebook-github-bot committed May 3, 2017
1 parent 9a2d6da commit 5084e1ba0fcfc6409898d746086629011e7134da
Showing with 8 additions and 8 deletions.
  1. +4 −4 Libraries/Lists/SectionList.js
  2. +4 −4 Libraries/Lists/VirtualizedSectionList.js
@@ -25,7 +25,7 @@ type SectionBase<SectionItemT> = {
/**
* The data for rendering items in this section.
*/
data: Array<SectionItemT>,
data: $ReadOnlyArray<SectionItemT>,
/**
* Optional key to keep track of section re-ordering. If you don't plan on re-ordering sections,
* the array index will be used by default.
@@ -56,13 +56,13 @@ type RequiredProps<SectionT: SectionBase<any>> = {
*
* General shape:
*
* sections: Array<{
* data: Array<SectionItem>,
* sections: $ReadOnlyArray<{
* data: $ReadOnlyArray<SectionItem>,
* renderItem?: ({item: SectionItem, ...}) => ?React.Element<*>,
* ItemSeparatorComponent?: ?ReactClass<{highlighted: boolean, ...}>,
* }>
*/
sections: Array<SectionT>,
sections: $ReadOnlyArray<SectionT>,
};
type OptionalProps<SectionT: SectionBase<any>> = {
@@ -25,7 +25,7 @@ type SectionItem = any;
type SectionBase = {
// Must be provided directly on each section.
data: Array<SectionItem>,
data: $ReadOnlyArray<SectionItem>,
key?: string,
// Optional props will override list-wide props just for this section.
@@ -49,7 +49,7 @@ type SectionBase = {
};
type RequiredProps<SectionT: SectionBase> = {
sections: Array<SectionT>,
sections: $ReadOnlyArray<SectionT>,
};
type OptionalProps<SectionT: SectionBase> = {
@@ -120,7 +120,7 @@ export type Props<SectionT> =
OptionalProps<SectionT> &
VirtualizedListProps;
type DefaultProps = (typeof VirtualizedList.defaultProps) & {data: Array<Item>};
type DefaultProps = (typeof VirtualizedList.defaultProps) & {data: $ReadOnlyArray<Item>};
type State = {childProps: VirtualizedListProps};
/**
@@ -413,7 +413,7 @@ class ItemWithSeparator extends React.Component {
}
}
function getItem(sections: ?Array<Item>, index: number): ?Item {
function getItem(sections: ?$ReadOnlyArray<Item>, index: number): ?Item {
if (!sections) {
return null;
}

0 comments on commit 5084e1b

Please sign in to comment.