[[oktatas:telefon:react_native|< React Native]] ====== React Native lista ====== * **Szerző:** Sallai András * Copyright (c) Sallai András, 2023 * Licenc: [[https://creativecommons.org/licenses/by-sa/4.0/|CC Attribution-Share Alike 4.0 International]] * Web: https://szit.hu ====== Egyszerűen ====== import { StatusBar } from 'expo-status-bar'; import { FlatList, StyleSheet, Text, View } from 'react-native'; const employees = [ {id: 1, name: 'Erős István', city: 'Szeged'}, {id: 2, name: 'Táncos Ernő', city: 'Szeged'}, {id: 3, name: 'Szabó Tamás', city: 'Szeged'} ]; export default function App() { return ( Dolgozók ( {item.name} {item.city} )} /> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', width: 200, }, item: { flexDirection: 'row', }, title: { marginTop: 24, }, }); ===== Megvalósítás ===== Megvalósítás GitHubon: * https://github.com/oktat/employees_rnlist.git (2023) ===== Dolgozók ===== import { StatusBar } from 'expo-status-bar'; import { FlatList, StyleSheet, Text, View } from 'react-native'; const employees = [ {id: 1, name: 'Erős István', city: 'Szeged'}, {id: 2, name: 'Táncos Ernő', city: 'Szeged'}, {id: 3, name: 'Szabó Tamás', city: 'Szeged'} ]; const Item = ({name,city}) => ( {name} {city} ); export default function App() { return ( Dolgozók } keyExtractor={item => item.id} /> ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, cell: { fontSize: 12, padding: 3, }, city: { color: 'red', }, item: { flexDirection: 'row', flexWrap: 'wrap' }, }); ===== Link ===== * https://reactnative.dev/docs/flatlist (2023)