Files
react-native/packages/rn-tester/js/examples/SectionList/SectionList-onViewableItemsChanged.js
T
Luna Wei 8f2c51bde3 Example update to flex 1 and and make visibilityConfig as prop
Summary:
Changelog:
[General][Changed] - Updated SectionList example in RNTester

Lists need an explicit height set, otherwise their intrinsic height is the height of the root view. This causes rendering issues as shown in the test plan.

Additionally, refactored to allow visibilityConfig to be passed as prop for future tests.

Reviewed By: kacieb

Differential Revision: D27098086

fbshipit-source-id: b19155de79d00dddc287a1e2f9cdb240f2f31e27
2021-03-18 11:36:28 -07:00

41 lines
1.1 KiB
JavaScript

/**
* 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.
*
* @format
* @flow
*/
'use strict';
import {SectionList_onViewableItemsChanged} from './SectionListExamples';
const React = require('react');
const VIEWABILITY_CONFIG = {
minimumViewTime: 1000,
viewAreaCoveragePercentThreshold: 100,
waitForInteraction: true,
};
exports.title = 'SectionList onViewableItemsChanged';
exports.testTitle = 'Test onViewableItemsChanged callback';
exports.category = 'ListView';
exports.documentationURL = 'https://reactnative.dev/docs/sectionlist';
exports.description =
'Scroll list to see what items are returned in `onViewableItemsChanged` callback.';
exports.examples = [
{
title: 'SectionList onViewableItemsChanged',
render: function(): React.Element<
typeof SectionList_onViewableItemsChanged,
> {
return (
<SectionList_onViewableItemsChanged
viewabilityConfig={VIEWABILITY_CONFIG}
/>
);
},
},
];