/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/
'use strict';
import * as React from 'react';
import SectionList from '../SectionList';
function renderMyListItem(info: {
item: {title: string, ...},
index: number,
...
}) {
return ;
}
const renderMyHeader = ({
section,
}: {
section: {fooNumber: number, ...} & Object,
...
}) => ;
module.exports = {
testGoodDataWithGoodItem(): React.Node {
const sections = [
{
key: 'a',
data: [
{
title: 'foo',
key: 1,
},
],
},
];
return ;
},
testBadRenderItemFunction(): $TEMPORARY$array {
const sections = [
{
key: 'a',
data: [
{
title: 'foo',
key: 1,
},
],
},
];
return [
}
sections={sections}
/>,
}
sections={sections}
/>,
// EverythingIsFine
}
sections={sections}
/>,
];
},
testBadInheritedDefaultProp(): React.Element<*> {
const sections = [];
return (
);
},
testMissingData(): React.Element<*> {
// $FlowExpectedError - missing `sections` prop
return ;
},
testBadSectionsShape(): React.Element<*> {
const sections = [
{
key: 'a',
items: [
{
title: 'foo',
key: 1,
},
],
},
];
// $FlowExpectedError - section missing `data` field
return ;
},
testBadSectionsMetadata(): React.Element<*> {
const sections = [
{
key: 'a',
fooNumber: 'string',
data: [
{
title: 'foo',
key: 1,
},
],
},
];
return (
);
},
};