6.0.1 • Published 4 years ago

react-native-bpk-component-chip v6.0.1

Weekly downloads
3
License
Apache-2.0
Repository
github
Last release
4 years ago

react-native-bpk-component-chip

Backpack React Native chip component.

Installation

npm install react-native-bpk-component-chip --save-dev

Usage

import React, { Component } from 'react';
import { StyleSheet, View } from 'react-native';
import { spacingBase } from 'bpk-tokens/tokens/base.react.native';
import BpkChip, { BpkDismissibleChip } from 'react-native-bpk-component-chip';

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    padding: spacingBase,
  },
});

export default class App extends Component {
  constructor() {
    super();
    this.state = {
      flightsSelected: false,
      showHotels: true,
    };
  }

  dismiss = () => {
    this.setState({
      showHotels: false,
    });
  };

  toggle = () => {
    this.setState({
      flightsSelected: !this.state.flightsSelected,
    });
  };

  render() {
    return (
      <View style={styles.container}>
        <BpkChip
          accessibilityLabel="Toggle flights"
          label="Flights"
          onPress={this.toggle}
          selected={this.state.flightsSelected}
        />
        { this.state.showHotels &&
          <BpkDismissibleChip
            accessibilityLabel="Remove hotels"
            label="Hotels"
            onPress={this.dismiss}
          />
        }
      </View>
    );
  }
}

Props

BpkChip

PropertyPropTypeRequiredDefault Value
accessibilityLabelstringtrue-
onPressfunctrue-
labelstringtrue-
disabledboolfalsefalse
selectedboolfalsefalse
innerChipStyleViewStylefalsenull
typeoneOf(CHIP_TYPES)falseprimary

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

PropertyPropTypeRequiredDefault Value
accessibilityLabelstringtrue-
labelstringtrue-
onPressfunctrue-
disabledboolfalsefalse
innerChipStyleViewStylefalsenull
typeoneOf(CHIP_TYPES)falseprimary

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!)

6.0.1

4 years ago

6.0.0

4 years ago

5.1.12

4 years ago

5.1.11

4 years ago

5.1.10

4 years ago

5.1.9

4 years ago

5.1.8

4 years ago

5.1.7

4 years ago

5.1.6

4 years ago

5.1.5

4 years ago

5.1.4

4 years ago

5.1.3

4 years ago

5.1.3-alpha.1

4 years ago

5.1.2

4 years ago

5.1.1

4 years ago

5.1.0

4 years ago

5.0.6

4 years ago

5.0.5

4 years ago

5.0.4

5 years ago

5.0.3

5 years ago

5.0.2

5 years ago

5.0.1

5 years ago

5.0.0

5 years ago

4.1.7

5 years ago

4.1.6

5 years ago

4.1.5

5 years ago

4.1.4

5 years ago

4.1.3

5 years ago

4.1.2

5 years ago

4.1.1

5 years ago

4.1.0

5 years ago

4.0.4

5 years ago

4.0.3

5 years ago

4.0.2

5 years ago

4.0.0

5 years ago

3.2.12

5 years ago

3.2.11

5 years ago

3.2.10

5 years ago

3.2.9

5 years ago

3.2.8

5 years ago

3.2.7

5 years ago

3.2.6

5 years ago

3.2.5

5 years ago

3.2.4

5 years ago

3.2.3

5 years ago

3.2.2

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.21

5 years ago

3.1.20

5 years ago

3.1.19

5 years ago

3.1.18

5 years ago

3.1.17

5 years ago

3.1.16

5 years ago

3.1.15

5 years ago

3.1.14

5 years ago

3.1.13

5 years ago

3.1.12

5 years ago

3.1.11

5 years ago

3.1.10

5 years ago

3.1.9

5 years ago

3.1.8

5 years ago

3.1.7

5 years ago

3.1.6

5 years ago

3.1.5

5 years ago

3.1.5-beta.1

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.24

6 years ago

1.0.23

6 years ago

1.0.22

6 years ago

1.0.20

6 years ago

1.0.19

6 years ago

1.0.18

6 years ago

1.0.17

6 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago