React native snippet. Simple notification list

This react native snippet, Simple notification list, was created to help android and ios developers save time
while they build native mobile apps using JavaScript and React
use it in your project and build your app faster

React native code

Copy, paste and run the following code to get a result like the one shown in the image


import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  Image,
  ListView,
} from 'react-native';

export default class NotificationsView extends Component {

  constructor(props) {
    super(props);
    const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
    this.state = {
      dataSource: ds.cloneWithRows([
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"}, 
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"}, 
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"}, 
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"}, 
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"}, 
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"}, 
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"},
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"},
        {description: "Lorem ipsum dolor sit amet, indu consectetur adipiscing elit"},
      ]),
    };
  }
  
  render() {
    return (
      <View style={styles.container}>
        <ListView style={styles.notificationList} enableEmptySections={true}
          dataSource={this.state.dataSource}
          renderRow={(notification) => {
            return (
              <View style={styles.notificationBox}>
                <Image style={styles.icon}
                  source={{uri: 'https://png.icons8.com/notification/ultraviolet/50/3498db'}}/>
                
                <Text style={styles.description}>{notification.description}</Text>
              </View>
            )}}/>
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container:{
    backgroundColor:'#DCDCDC'
  },
  notificationList:{
    marginTop:20,
    padding:10,
  },
  notificationBox: {
    padding:20,
    marginTop:5,
    marginBottom:5,
    backgroundColor: '#FFFFFF',
    flexDirection: 'row',
    borderRadius:10,
  },
  icon:{
    width:45,
    height:45,
  },
  description:{
    fontSize:18,
    color: "#3498db",
    marginLeft:10,
  },
});
 

About this react-native snippet

This react-native snippet, Simple notification list, was published on Oct 30th 2017, 18:01 by Dey Dey and it is free.

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

This snippet currectly have 2.6K views, Using this react-native snippet 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 project.

Cross-platform for mobile development

This snippet was developed for Android and iOS.

Simple Integration

This snippet 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.