React native UI example/template. post list like masonry

React Native example/template, post list like masonry! . Take a look at this UI example and see how it can enhance your project. You can copy or download the code and use it in your project. Don't forget to browse our library of other free React Native templates for even more design and functionality inspiration. Happy coding!

import { View, Text, Image, StyleSheet, FlatList } from 'react-native';

const PostList = () => {
  const data = [
    {
      id: '1',
      image: 'https://www.bootdey.com/image/1260x750/8A2BE2/000000',
      title: 'Cute Cat',
      subtitle: 'Feline friend'
    },
    {
      id: '2',
      image: 'https://www.bootdey.com/image/1260x750/5F9EA0/000000',
      title: 'Majestic Mountain',
      subtitle: 'Natural wonder'
    },
    {
      id: '3',
      image: 'https://www.bootdey.com/image/1260x750/FF7F50/000000',
      title: 'Delicious Pizza',
      subtitle: 'Yum!'
    },
    {
      id: '4',
      image: 'https://www.bootdey.com/image/1260x750/00FFFF/000000',
      title: 'Beautiful Beach',
      subtitle: 'Paradise'
    },
    {
      id: '5',
      image: 'https://www.bootdey.com/image/1260x750/FF00FF/000000',
      title: 'Crazy Concert',
      subtitle: 'Rock on!'
    },
  ];


  const renderItem = ({ item, index }) => {
    return (
      <View style={styles.itemContainer}>
        <Image source={{ uri: item.image }} style={styles.image} />
        <View style={styles.textContainer}>
          <Text style={styles.title}>{item.title}</Text>
          <Text style={styles.subtitle}>{item.subtitle}</Text>
        </View>
      </View>
    );
  };

  return (
    <FlatList
      data={data}
      contentContainerStyle={styles.container}
      renderItem={renderItem}
      keyExtractor={(item) => item.id}
      numColumns={2}
    />
  );
};

const styles = StyleSheet.create({
  container: {
    backgroundColor:'#fff'
  },
  itemContainer: {
    flex: 1,
    padding: 16,
    alignItems: 'center',
    justifyContent: 'center',
    flexDirection:  'column' 
  },
  image: {
    width: '100%',
    height: 200,
    resizeMode: 'cover',
    borderRadius: 8,
  },
  textContainer: {
    padding: 16,
  },
  title: {
    fontWeight: 'bold',
    fontSize: 18,
  },
  subtitle: {
    fontSize: 14,
    color: 'gray',
  },
});

export default PostList;

                                            

Similar snippets

About this react-native template

This react-native template, post list like masonry, was published on Jan 26th 2023, 09:29 by Bootdey Admin and it is free.

We hope you will enjoy this awesome react-native template and stay tuned for the latest updates, we believe it will save your precious time and gives trendy look to your next application.

This template currectly have 2.4K views, Using this react-native template you have the following benefits:

Example Screens

You can jump start your development with our pre-built example, all you need to do is copy the code and execute it, You can also show it to your customers so that they have an idea of the final result.

Cross-platform for mobile development

This template was developed for Android and iOS.

Simple Integration

This template can be simply integrated on existing projects and new ones too, all you need to do is copy the code and start working.

Fully coded view

this is a functional example, You will save a lot of time going from prototyping to full-functional code.