0.1.3 • Published 5 years ago

@thang2162/react-native-tile-view v0.1.3

Weekly downloads
1
License
Unlicense
Repository
-
Last release
5 years ago

React Native Tile View

A utility for creating tile views in react native!

npm version

npm

Platform - Android and iOS

License: Unlicense

Installation

Add the dependency:

React Native:

npm i @thang2162/react-native-tile-view

or,

yarn add @thang2162/react-native-tile-view

Peer Dependencies

IMPORTANT! You need install them.
"react": ">= 16.x.x",
"react-native": ">= 0.55.x",

Basic Usage

import TileView from "@thang2162/react-native-tile-view";

const tiles = [
  {tpr: 1, tileHeight: 200, touchable: true, data: {text: 'hello', number: 5}},
  {tpr: 2, tileHeight: 200, data: {number: 5}},
  {tpr: 2, tileHeight: 200, touchable: true, data: {text: 'hello'}},
  {tpr: 3, data: {number: 5}},
  {tpr: 3, touchable: true, data: {text: 'hello'}},
  {tpr: 3, data: {text: 'hello', number: 5}},
  {tpr: 4, data: {text: 'hello'}},
  {tpr: 4, data: {number: 5}},
  {tpr: 4, data: {text: 'hello'}},
  {tpr: 4, data: {text: 'hello', number: 5}},
];

const tileContent = (data) => (
  <View>
    <Text>{data.text}</Text>
    {data.number && <Text>{data.number}</Text>}
  </View>
);

<TileView
  tiles={tiles}
  tileContent={tileContent}
/>

Configuration - Props

PropertyTypeDefaultDescription
customStylestyleSet your own style
showChildrenbooleantrue or falseShow child slot content instead of tiles
tileContent - requiredjsxSet the template for your tiles
tiles - requiredarray[]Object array containing tile data
onTileTouchcallbackCallback for touchable tiles
refreshControljsxSet a Refresh Control for pull to refresh
tileSizenumber1Resize your tiles

Tiles - Object Structure Details

tpr or tiles per row is required and sets the size of the tiles.

touchable is optional and makes the tile in question touchable. Callback will return the index of object in the array as well as the object in the data key.

tileHeight is optional and allows you to set the height of each tile.

tileStyle is optional and allows you to override the default tile style of each tile. tileStyle must be initialized through StyleSheet.create().

data is optional and where you put data you wish to be available in the tileContent

Custom Styles - Details

To change the main container set styles under the container key in the style Object.

To change the item container set styles under the tile key in the style Object.

The style object must be initialized through StyleSheet.create() before being set into the customStyle prop. See the example for more details.

Author

thang2162, netguy87@gmail.com

License

React Native Tile View Library is available under the Unlicense. See the LICENSE file for more info.

0.1.3

5 years ago

0.1.0

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago