react-native-bpk-component-text

5.0.1 • Public • Published

react-native-bpk-component-text

Backpack React Native text component.

Installation

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

Usage

import React, { Component } from 'react';
import { View, StyleSheet } from 'react-native';
import BpkText, { WEIGHT_STYLES } from 'react-native-bpk-component-text';
import { spacingBase } from 'bpk-tokens/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}>
        <BpkText textStyle='xxl'>Backpack rocks!</BpkText>
        <BpkText textStyle='xl' weight={WEIGHT_STYLES.heavy}>Backpack rocks!</BpkText>
        <BpkText textStyle='lg' weight={WEIGHT_STYLES.emphasized}>Backpack rocks!</BpkText>
        <BpkText textStyle='base'>Backpack rocks!</BpkText>
        <BpkText textStyle='sm'>Backpack rocks!</BpkText>
        <BpkText textStyle='xs'>Backpack rocks!</BpkText>
        <BpkText textStyle='caps'>BACKPACK ROCKS!</BpkText>
      </View>
    );
  }
}

Props

Property PropType Required Default Value
children node true -
textStyle oneOf('xxl', 'xl', 'lg', 'base', 'sm', 'xs', 'caps') false base
weight oneOf('regular', 'emphasized', 'heavy') false regular
emphasize (deprecated, use weight) bool false false

Theme props

  • textFontFamily

NOTE: For Android we expect font names to follow a specific name convention for bold and heavy variations. E.g. if you provide a font called myFont to the textFontFamilytheme attribute, we expect two more fonts to be available, those are myFont_bold and myFont_black.

Versions

Current Tags

Version History

Package Sidebar

Install

npm i react-native-bpk-component-text

Weekly Downloads

0

Version

5.0.1

License

Apache-2.0

Unpacked Size

79.2 kB

Total Files

16

Last publish

Collaborators

  • anambl
  • skyscanner-koalasquad
  • gert-jan.vercauteren
  • frugoman
  • marianeumayer-skyscanner
  • ojcurt