Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react native expo flatlist

import React from 'react';
import { SafeAreaView, View, FlatList, StyleSheet, Text, StatusBar } from 'react-native';

const DATA = [
  {
    id: 'bd7acbea-c1b1-46c2-aed5-3ad53abb28ba',
    title: 'First Item',
  },
  {
    id: '3ac68afc-c605-48d3-a4f8-fbd91aa97f63',
    title: 'Second Item',
  },
  {
    id: '58694a0f-3da1-471f-bd96-145571e29d72',
    title: 'Third Item',
  },
];

const Item = ({ title }) => (
  <View style={styles.item}>
    <Text style={styles.title}>{title}</Text>
  </View>
);

const App = () => {
  const renderItem = ({ item }) => <Item title={item.title} />;

  return (
    <SafeAreaView style={styles.container}>
      <FlatList data={DATA} renderItem={renderItem} keyExtractor={item => item.id} />
    </SafeAreaView>
  );
};

const styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop: StatusBar.currentHeight || 0,
  },
  item: {
    backgroundColor: '#f9c2ff',
    padding: 20,
    marginVertical: 8,
    marginHorizontal: 16,
  },
  title: {
    fontSize: 32,
  },
});

export default App;
Comment

PREVIOUS NEXT
Code Example
Javascript :: javascript single thread 
Javascript :: react video 
Javascript :: 2d array includes array js 
Javascript :: js concat 
Javascript :: JavaScript then() method 
Javascript :: materialize dropdown js 
Javascript :: change inptu val 
Javascript :: ? operator in js 
Javascript :: js promises 
Javascript :: closest js 
Javascript :: get downloadable link to s3 bucket object js 
Javascript :: console.log() Print a Sentence 
Javascript :: react usememo 
Javascript :: math random javascript 
Javascript :: vue date filter component 
Javascript :: js number to str 
Javascript :: javascript get clock time in auto counter up 
Javascript :: findone and update mongoose 
Javascript :: reverse string in javascript 
Javascript :: show modal by using id in list react 
Javascript :: js add query param 
Javascript :: sequelize transaction config 
Javascript :: new date 
Javascript :: mongoose patch document 
Javascript :: Upload different files in different folders using Multer in NodeJs 
Javascript :: enzyme testing 
Javascript :: javascript create object empty 
Javascript :: jest express testing 
Javascript :: js map 
Javascript :: react router switch 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =