Skip to content

Instantly share code, notes, and snippets.

@react-ram
Created January 9, 2020 07:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save react-ram/022a05536be17d83c2818aef1247ea3e to your computer and use it in GitHub Desktop.
Save react-ram/022a05536be17d83c2818aef1247ea3e to your computer and use it in GitHub Desktop.
dashboard sample code
import React, {Component} from 'react';
import {View, ScrollView} from 'react-native';
import {List, Divider, Colors} from 'react-native-paper';
const vehicles = [
{id: 1, no: 'AP28X1234'},
{id: 2, no: 'AP28X1222'},
{id: 3, no: 'AP28X1333'},
{id: 4, no: 'AP28X1234'},
{id: 5, no: 'AP28X1222'},
{id: 36, no: 'AP28X1333'},
{id: 17, no: 'AP28X1234'},
{id: 28, no: 'AP28X1222'},
{id: 39, no: 'AP28X1333'},
{id: 10, no: 'AP28X1234'},
{id: 255, no: 'AP28X1222'},
{id: 34, no: 'AP28X1333'},
{id: 13, no: 'AP28X1234'},
{id: 233, no: 'AP28X1222'},
{id: 323, no: 'AP28X1333'},
{id: 112, no: 'AP28X1234'},
{id: 221, no: 'AP28X1222'},
{id: 32, no: 'AP28X1333'},
];
export default class Vehicles extends Component {
render() {
return (
<ScrollView>
{vehicles.map(vehicle => {
return (
<React.Fragment key={vehicle.id.toString()}>
<List.Item
title={vehicle.no}
left={props => (
<List.Icon {...props} icon="truck" color={Colors.green300} />
)}
onPress={() => console.warn(vehicle.id)}
/>
<Divider />
</React.Fragment>
);
})}
</ScrollView>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment