1.0.3 • Published 4 years ago

react-native-material-chip v1.0.3

Weekly downloads
215
License
MIT
Repository
github
Last release
4 years ago

React native material chip

Material chip

React Native component for Anroid and iOS inspired by Material Design Chip

Installing

Install react-native-material-chip:

yarn add react-native-material-chip
or
npm install react-native-material-chip

Usage

Examples

import React from 'react'
import MaterialChip from "react-native-material-chip"

const BasicExample = () => {
    return (
        <MaterialChip
            text="Example"
            checked={true}
            onPress={() => console.log('press')}
            onDelete={() => console.log('delete')}
            textStyle={{color: 'rgba(0, 0, 0, 0.87)'}}
            leftIcon={
                <View
                    style={{
                        height: MaterialChip.CHIP_LEFT_ICON_SIZE,
                        width: MaterialChip.CHIP_LEFT_ICON_SIZE,
                        borderRadius: MaterialChip.CHIP_RADIUS,
                        backgroundColor: 'rgba(252,0,0,1)',
                        borderWidth: 0
                    }}
                />
            }
            rightIcon={
                <View
                    style={{
                        height: MaterialChip.CHIP_RIGHT_ICON_SIZE,
                        width: MaterialChip.CHIP_RIGHT_ICON_SIZE,
                        borderRadius: MaterialChip.CHIP_RIGHT_ICON_RADIUS,
                        backgroundColor: 'rgba(252,0,0,1)',
                        borderWidth: 0
                    }}
                />
            }
        />    
    )
}

export default BasicExample

<MaterialChip /> component api

Props

The component extents the ViewProperties

PropTypeDefault
textstring
checkedbooleanfalse
onPressfunctionnull
leftIconelementnull
rightIconelementnull
onDeletefunctionnull
textStyleobjectnull

Constants

PropTypeValue
CHIP_HEIGHTnumber32dp
CHIP_RADIUSnumber16dp
CHIP_MARGINnumber14dp
CHIP_TEXT_SIZEnumber14dp
CHIP_TEXT_MARGINnumber16dp
CHIP_LEFT_ICON_SIZEnumber24dp
CHIP_LEFT_ICON_RADIUSnumber12dp