React native UI example/template. Chat with background image cards

React Native example/template, Chat with background image cards! . 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!

React native template. Chat with background image cards

Chat with background image cards

import React, { useState } from 'react'
import { View, Text, StyleSheet, FlatList, Image, TextInput, TouchableOpacity } from 'react-native'

const Chat = () => {
  const [messages, setMessages] = useState([
    {
      id: 1,
      sender: 'John',
      text: 'Hey, how are you?',
      senderType: 'user',
      avatar: 'https://www.bootdey.com/img/Content/avatar/avatar2.png',
      image: null,
    },
    {
      id: 2,
      sender: 'Jane',
      text: "I'm doing well, thanks for asking. How about you?",
      senderType: 'other',
      avatar: 'https://www.bootdey.com/img/Content/avatar/avatar3.png',
      image: 'https://www.bootdey.com/image/280x280/FF00FF/000000',
    },
    {
      id: 3,
      sender: 'John',
      text: "I'm doing well too. Do you want to grab a coffee later?",
      senderType: 'user',
      avatar: 'https://www.bootdey.com/img/Content/avatar/avatar2.png',
      image: 'https://www.bootdey.com/image/280x280/00FFFF/000000',
    },
    {
      id: 4,
      sender: 'Jane',
      text: "I'm doing well, thanks for asking. How about you?",
      senderType: 'other',
      avatar: 'https://www.bootdey.com/img/Content/avatar/avatar3.png',
      image: null,
    },
  ])

  const [newMessage, setNewMessage] = useState('')

  const renderItem = ({ item }) => {
    return (
      <View
        style={[
          styles.message,
          item.senderType === 'user' ? styles.userMessage : styles.otherMessage,
        ]}>
        <Image style={styles.avatar} source={{ uri: item.avatar }} />
        <View style={styles.messageContent}>
          <Text style={styles.sender}>{item.sender}</Text>
          {item.image && <Image style={styles.messageImage} source={{ uri: item.image }} />}
          <Text>{item.text}</Text>
        </View>
      </View>
    )
  }

  const handleSend = () => {
    if (!newMessage) return

    setMessages([
      ...messages,
      {
        id: messages[messages.length - 1].id + 1,
        sender: 'John',
        text: newMessage,
        senderType: 'user',
        avatar: 'https://www.bootdey.com/img/Content/avatar/avatar2.png',
      },
    ])
    setNewMessage('')
  }

  return (
    <View style={styles.container}>
      <Image
        style={styles.backgroundImage}
        source={{ uri: 'https://www.bootdey.com/image/600x600/dcdcdc/000000' }}
      />
      <View style={[styles.header,
//LOGIN TO SEE THE REST OF THE CODE ======.=====]}>
        <=====
          ======{======.===========}
          ======={{ ===: '=====://===.=======.===/===/=======/======/=======.===' }}
        />
        <==== ======{======.=============}>====</====>
      </====>
      <======== ====={========} ==========={==========} ============={==== => ====.==.========()} />
      <==== ======{======.==============}>
        <=========
          ======{======.=====}
          ======{==========}
          ============={=============}
          ============"===== = ======="
        />
        <================ ======{======.==========} ========{==========}>
          <==== ======{======.==============}>====</====>
        </================>
      </====>
    </====>
  )
}

===== ====== = ==========.======({
  =========: {
    ====: =,
    ========: '========',
  },
  ===============: {
    ========: '========',
    ===: =,
    ====: =,
    =====: =,
    ======: =,
    ==========: '=====',
  },
  ======: {
    =============: '===',
    ==========: '======',
    =======: ==,
  },
  =====: {
    ===============: '=====',
  },
  ===========: {
    =====: ==,
    ======: ==,
    ============: ==,
    ===========: ==,
  },
  =============: {
    ========: ==,
    ==========: '====',
  },
  =======: {
    =============: '===',
    =======: ==,
    ============: ==,
    ======: ==,
    ===========: '#===',
    ============: { =====: =, ======: = },
    =============: =.=,
    ============: =,
  },
  ======: {
    =====: ==,
    ======: ==,
    ============: ==,
    ===========: ==,
  },
  ===========: {
    =========: '====-===',
    ===============: '=========',
  },
  ============: {
    =========: '====-=====',
    ===============: '=========',
  },
  ==============: {
    ====: =,
  },
  ======: {
    ==========: '====',
  },
  ============: {
    =====: ===,
    ======: ===,
    ============: ==,
  },
  ==============: {
    =============: '===',
    ==========: '======',
    ======: ==,
  },
  =====: {
    ====: =,
    ======: ==,
    ===========: =,
    ===========: '====',
    ============: =,
    =======: =,
    ===========: ==,
  },
  ==========: {
    ===============: '====',
    =======: ==,
    ============: =,
  },
  ==============: {
    =====: '=====',
    ==========: '====',
    =========: '======',
  },
})

====== ======= ====

                                            

Similar snippets

React native template. WhatsApp call screen ui example

WhatsApp call screen ui example

About this react-native template

This react-native template, Chat with background image cards, was published on Jan 2nd 2023, 15:19 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.5K 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.