/** * 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. * * @format * @flow */ const RNTesterExampleFilter = require('./RNTesterExampleFilter'); import RNTPressableRow from './RNTPressableRow'; const React = require('react'); const { Platform, SectionList, StyleSheet, Text, TouchableHighlight, Image, View, } = require('react-native'); import {RNTesterThemeContext} from './RNTesterTheme'; /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's * LTI update could not be added via codemod */ const ExampleModuleRow = ({ onShowUnderlay, onHideUnderlay, item, toggleBookmark, handlePress, }) => { const theme = React.useContext(RNTesterThemeContext); const platform = item.module.platform; const onIos = !platform || platform === 'ios'; const onAndroid = !platform || platform === 'android'; const rightAddOn = ( toggleBookmark({ exampleType: item.exampleType, key: item.key, }) }> ); return ( {item.module.category || 'Other'} iOS Android } onPress={() => handlePress({ exampleType: item.exampleType, key: item.key, title: item.module.title, }) } /> ); }; const renderSectionHeader = ({section}: {section: any, ...}) => ( {theme => { return ( {section.title} ); }} ); const RNTesterModuleList: React$AbstractComponent = React.memo( ({sections, toggleBookmark, handleModuleCardPress}) => { const filter = ({example, filterRegex, category}: any) => filterRegex.test(example.module.title) && (!category || example.category === category); /* $FlowFixMe[missing-local-annot] The type annotation(s) required by * Flow's LTI update could not be added via codemod */ const renderListItem = ({item, section, separators}) => { return ( ); }; return ( ( } /> )} /> ); }, ); const styles = StyleSheet.create({ listContainer: { flex: 1, }, sectionHeader: { padding: 5, fontWeight: '500', fontSize: 11, }, row: { justifyContent: 'center', paddingHorizontal: 15, paddingVertical: 12, marginVertical: Platform.select({ios: 4, android: 8}), marginHorizontal: 15, overflow: 'hidden', elevation: 5, }, topRowStyle: { flexDirection: 'row', justifyContent: 'space-between', flex: 1, }, bottomRowStyle: { flexDirection: 'row', justifyContent: 'space-between', }, imageViewStyle: { height: 30, width: 30, borderRadius: 15, justifyContent: 'center', alignItems: 'center', position: 'relative', bottom: 5, }, imageStyle: { height: 25, width: 25, }, platformLabelStyle: { flexDirection: 'row', width: 100, justifyContent: 'space-between', }, }); module.exports = RNTesterModuleList;