Skip to content

Latest commit

 

History

History

bpk-component-icon

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

bpk-component-icon

Backpack React Native icon component.

Icons

Day Night
bpk-component-icon icons iPhone 8 simulator bpk-component-icon icons iPhone 8 simulator - dark mode
bpk-component-icon icons Google Pixel emulator bpk-component-icon icons Google Pixel emulator - dark mode

Installation

Check the main Readme for a complete installation guide.

Usage

import { View } from 'react-native';
import React, { Component } from 'react';
import BpkIcon, { icons } from 'backpack-react-native/bpk-component-icon';
import { spacingBase, colorSkyBlue } from '@skyscanner/bpk-foundations-react-native/tokens/base.react.native';

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

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <BpkIcon
          icon={icons.beer}
          style={{ color: colorSkyBlue }}
          small
        />
        <BpkIcon
          icon={icons.beer}
          style={{ color: colorSkyBlue }}
        />
      </View>
    );
  }
}

withRtlSupport HOC

import { View } from 'react-native';
import React, { Component } from 'react';
import BpkIcon, { icons, withRtlSupport } from 'backpack-react-native/bpk-component-icon';
import { spacingBase, colorSkyBlue } from '@skyscanner/bpk-foundations-react-native/tokens/base.react.native';

const BpkIconwithRtlSupport = withRtlSupport(BpkIcon);

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

export default class App extends Component {
  render() {
    return (
      <View style={styles.container}>
        <BpkIconwithRtlSupport
          icon={icons.beer}
          style={{ color: colorSkyBlue }}
        />
      </View>
    );
  }
}

Props

Property PropType Required Default Value
icon string true -
small bool false false