Skip to content

Latest commit

 

History

History

bpk-component-panel

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

bpk-component-panel

Backpack React Native panel component.

Default

Day Night
bpk-component-panel default iPhone 8 simulator bpk-component-panel default iPhone 8 simulator - dark mode
bpk-component-panel default Google Pixel emulator bpk-component-panel default Google Pixel emulator - dark mode

Without padding

Day Night
bpk-component-panel without-padding iPhone 8 simulator bpk-component-panel without-padding iPhone 8 simulator - dark mode
bpk-component-panel without-padding Google Pixel emulator bpk-component-panel without-padding Google Pixel emulator - dark mode

With divider

Day Night
bpk-component-panel with-divider iPhone 8 simulator bpk-component-panel with-divider iPhone 8 simulator - dark mode
bpk-component-panel with-divider Google Pixel emulator bpk-component-panel with-divider Google Pixel emulator - dark mode

With divider arranged vertically

Day Night
bpk-component-panel with-divider-arranged-vertically iPhone 8 simulator bpk-component-panel with-divider-arranged-vertically iPhone 8 simulator - dark mode
bpk-component-panel with-divider-arranged-vertically Google Pixel emulator bpk-component-panel with-divider-arranged-vertically Google Pixel emulator - dark mode

Installation

Check the main Readme for a complete installation guide.

Usage

import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import BpkPanel from 'backpack-react-native/bpk-component-panel';
import BpkText from 'backpack-react-native/bpk-component-text';
import { spacingBase } 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() {
    const content = (
      <BpkText>
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
        commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus
        et magnis dis parturient montes, nascetur ridiculus mus.
      </BpkText>
    );

    return (
      <View style={styles.container}>
        <BpkPanel>{content}</BpkPanel>
        <BpkPanel padded={false}>{content}</BpkPanel>
      </View >
    );
  }
}

withDivider HOC

import React, { Component } from 'react';
import { View, StyleSheet, Text } from 'react-native';
import BpkText from 'backpack-react-native/bpk-component-text';
import { spacingBase } from '@skyscanner/bpk-foundations-react-native/tokens/base.react.native';
import BpkPanel, { withDivider } from 'backpack-react-native/bpk-component-panel';

const BpkPanelWithDivider = withDivider(BpkPanel);

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

export default class App extends Component {
  render() {
    const content = (
      <BpkText>
        Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean
        commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus
        et magnis dis parturient montes, nascetur ridiculus mus.
      </BpkText>
    );

    return (
      <View style={styles.container}>
        <BpkPanelWithDivider stub={content}>{content}</BpkPanelWithDivider>
        <BpkPanelWithDivider stub={content} vertical>{content}</BpkPanelWithDivider>
        <BpkPanelWithDivider stub={content} padded={false}>{content}</BpkPanelWithDivider>
      </View >
    );
  }
}

Props

BpkPanel:

Property PropType Required Default Value
children node true -
padded bool false true

After withDivider:

Property PropType Required Default Value
stub node true -
vertical bool false false
mainStyle object false null
stubStyle object false null