Free react native UI example. Image Gallery List

Free React Native template, Image Gallery List! . Take a look at this UI example and see how it can enhance your project. Your 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!

react native UI example. Image Gallery List
Download
import React, { useState } from 'react'
import { StyleSheet, Text, View, TouchableOpacity, Image, Alert, FlatList } from 'react-native'

export default Galleries = () => {
  const data = [
    { id: 1, likes: 12, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 2, likes: 11, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 3, likes: 25, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 4, likes: 12, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 5, likes: 10, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 6, likes: 12, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 7, likes: 34, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 8, likes: 45, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 9, likes: 32, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
    { id: 9, likes: 56, image: 'https://www.bootdey.com/image/400x400/FF00FF/000000' },
  ]

  const [posts, setPosts] = useState(data)

  const addProductToCart = () => {
    Alert.alert('Success', 'Item selected')
  }

  return (
    <View style={styles.container}>
      <FlatList
        style={styles.list}
        contentContainerStyle={styles.listContainer}
        data={posts}
        horizontal={false}
        numColumns={2}
        keyExtractor={item => {
          return item.id
        }}
        ItemSeparatorComponent={() => {
          return <View style={styles.separator} />
        }}
        renderItem={({item}) => {
        
          return (
            <TouchableOpacity style={styles.card}>
              <Image style={styles.cardImage} source={{ uri:  item.image}} />
              <View style={styles.cardFooter}>
                <View style={styles.socialBarContainer}>
                  <View style={styles.socialBarSection}>
                    <TouchableOpacity
                      style={styles.socialBarButton}
                      onPress={addProductToCart}>
                      <Image
                        style={styles.icon}
                        source={{ uri: 'https://img.icons8.com/color/70/000000/share.png' }}
                      />
                      <Text style={[styles.socialBarLabel, styles.share]}>Share</Text>
                    </TouchableOpacity>
                  </View>
                  <View style={styles.socialBarSection}>
                    <TouchableOpacity style={styles.socialBarButton}>
                      <Image
                        style={styles.icon}
                        source={{ uri: 'https://img.icons8.com/color/70/000000/heart.png' }}
                      />
                      <Text style={styles.socialBarLabel}>{item.likes}</Text>
                    </TouchableOpacity>
                  </View>
                </View>
              </View>
            </TouchableOpacity>
          )
        }}
      />
    </View>
  )
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    marginTop: 20,
    backgroundColor: '#eee',
  },
  list: {
    paddingHorizontal: 5,
    backgroundColor: '#E6E6E6',
  },
  listContainer: {
    alignItems: 'center',
  },
  separator: {
    marginTop: 10,
  },
  /******** card **************/
  card: {
    marginVertical: 8,
    flexBasis: '47%',
    marginHorizontal: 5,
  },
  cardContent: {
    paddingVertical: 12.5,
    paddingHorizontal: 16,
  },
  cardFooter: {
    flexDirection: 'row',
    justifyContent: 'space-between',
    paddingTop: 12.5,
    paddingBottom: 25,
    paddingHorizontal: 16,
    borderBottomLeftRadius: 1,
    borderBottomRightRadius: 1,
  },
  cardImage: {
    height: 150,
    width: '100%',
    borderWidth:0.3
  },
  /******** card components **************/
  share: {
    color: '#25b7d3',
  },
  icon: {
    width: 25,
    height: 25,
  },
  /******** social bar ******************/
  socialBarContainer: {
    justifyContent: 'center',
    alignItems: 'center',
    flexDirection: 'row',
    flex: 1,
  },
  socialBarSection: {
    justifyContent: 'center',
    flexDirection: 'row',
    flex: 1,
  },
  socialBarlabel: {
    marginLeft: 8,
    alignSelf: 'flex-end',
    justifyContent: 'center',
  },
  socialBarButton: {
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
  },
})

                                            

Similar snippets

About this react-native template

This react-native template, Image Gallery List, was published on Nov 29th 2017, 18:03 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 4.6K 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.