react-native-bpk-component-chip
Backpack React Native chip component.
Installation
npm install react-native-bpk-component-chip --save-dev
Usage
;;;; const styles = StyleSheet; { super; thisstate = flightsSelected: false showHotels: true ; } { this; }; { this; }; { return <View style=stylescontainer> <BpkChip accessibilityLabel="Toggle flights" label="Flights" onPress=thistoggle selected=thisstateflightsSelected /> thisstateshowHotels && <BpkDismissibleChip accessibilityLabel="Remove hotels" label="Hotels" onPress=thisdismiss /> </View> ; }
Props
BpkChip
Property | PropType | Required | Default Value |
---|---|---|---|
accessibilityLabel | string | true | - |
onPress | func | true | - |
label | string | true | - |
disabled | bool | false | false |
selected | bool | false | false |
innerChipStyle | ViewStyle | false | null |
type | oneOf(CHIP_TYPES) | false | primary |
Note that on Android, style
should be used for positional styling and innerChipStyle
should be used for other styling.
(On iOS, style
and innerChipStyle
are applied together so it doesn't matter which you use!)
Theme Props
chipSelectedBackgroundColor
chipSelectedTextColor
chipOutlineSelectedBackgroundColor
chipOutlineSelectedTextColor
BpkDismissibleChip
Property | PropType | Required | Default Value |
---|---|---|---|
accessibilityLabel | string | true | - |
label | string | true | - |
onPress | func | true | - |
disabled | bool | false | false |
innerChipStyle | ViewStyle | false | null |
type | oneOf(CHIP_TYPES) | false | primary |
Note that on Android, style
should be used for positional styling and innerChipStyle
should be used for other styling.
(On iOS, style
and innerChipStyle
are applied together so it doesn't matter which you use!)