0.0.5 • Published 6 years ago

react-native-swipebox v0.0.5

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

react-native-swipebox

A simple swipe box component. Allows to be fully customizable.

alt text

Installation

React Native >= 0.49

yarn add react-native-swipebox

Attributes

PropDescriptionDefault
string backgroundColorSpecifies the background color of the component#828186
string borderColorSpecifies the border color of the componentundefined
number borderWidthSpecifies the border width of the componentundefined
number borderRadiusSpecifies the border radius of the component3
string textColorThe text color used when strings are rendered#ffffff
number fontSizeThe font size of the textauto
string fontFamilyThe font family of the textundefined
array/object tilesAn array or component object of the tiles to be renderedrequired
object styleA standard style object - will be applied to the main viewundefined
number sizeThe size of each tile. Used when width and height are not specified.120
number widthThe width of each tileundefined
number heightThe height of each tileundefined
number selectedIndexThe initial selected tileundefined

Events

PropDescription
onChangeExecuted when the tile was changed. Passes the index in the tiles array and the actual value
onSwipeDownExecuted when the user swipes down.
onSwipeUpExecuted when the user swipes up.

Examples

Import the component:

import SwipeBox from 'react-native-swipebox';

Simple Example

<SwipeBox
    tiles={[12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]}
    onChange={(index, value) => console.log(index, value)}
/>

Images

 <SwipeBox
    tiles={[
        <Image source={{url: 'ok.png'}} />,
        <Image source={{url: 'cancel.png'}} />,
    ]}
    onChange={(index, value) => console.log(index, value)}
/>

Select tile

 <SwipeBox
    tiles={[12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]}
    selectedIndex={4}
    onChange={(index, value) => console.log(index, value)}
/>

Components

Other components that are using this component:

react-native-swipetimepicker - A elegant and simple time picker.