GithubHelp home page GithubHelp logo

andrezero / backpack-react-native Goto Github PK

View Code? Open in Web Editor NEW

This project forked from skyscanner/backpack-react-native

0.0 1.0 0.0 191.87 MB

Backpack Design System

Home Page: https://backpack.github.io

License: Apache License 2.0

JavaScript 80.15% Kotlin 11.24% Ruby 0.44% Objective-C 7.34% Shell 0.64% C 0.01% Swift 0.06% Starlark 0.12%

backpack-react-native's Introduction

Backpack Design System for React Native

Backpack is a collection of design resources, reusable components and guidelines for creating Skyscanner's products.

Android Actions Build Status iOS Actions Build Status

Quick links

Usage

Installation

npm install backpack-react-native --save
Android

From source

Our Android code is written in Kotlin, so in order to compile it from source you need to have org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" in the classpath.

Add the following your root build.gradle file:

buildscript {
  ext.kotlin_version = '1.3.21'
  dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
  }
}

If you have defined project-wide properties in your root build.gradle, this library will detect the presence of the following properties:

  ext {
      compileSdkVersion   = 28
      targetSdkVersion    = 28
      minSdkVersion       = 21
      buildToolsVersion   = "28.0.3"
  }
  1. Define the backpack-react-native project in your settings.gradle file:
  include ':backpack-react-native'
  project(':backpack-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/backpack-react-native/android')
  1. Add bpk-appearance as a dependency in your app/module build.gradle file:
    dependencies {
      implementation project(':backpack-react-native')
    }

Pre compiled

Alternatively, the pre compiled version is available on Skyscanner's internal Artifactory.

    dependencies {
      implementation 'net.skyscanner.backpack:bpk-appearance:<version>'
    }
iOS

From source

Add the following dependencies to your Podfile using the path to the NPM package as follows:

  pod 'BackpackReactNative', path: '../node_modules/backpack-react-native/ios/BackpackReactNative'
  pod 'ReactNativeDarkMode', path: '../node_modules/react-native-dark-mode/ReactNativeDarkMode.podspec'
  pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'

Third party libs

This package depends on react-native-maps and its native components need to be integrated manually by following their instructions.

Configuration

Android
  1. Add the native packages to the getPackages function in your MainActiviy.
override fun getPackages(): List<ReactPackage> {
  return Arrays.asList(
        MainReactPackage(),
        ...
        MapsPackage(),
        LinearGradientPackage(),
        CalendarPackage(),
        DialogPackage(),
        BpkRatingPackage(),
        DarkModePackage(),
        BpkSnackbarPackage())
}
  1. Append |uiMode to the android:configChanges prop of <activity> in AndroidManifest.xml. Example:
<activity
    android:name=".MainActivity"
    android:exported="true"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode">

This ensures the RN code will react to system-wide changes to the current appearance.

Icons

This method has the advantage of fonts being copied from this module at build time so that the fonts and JS are always in sync, making upgrades painless.

Edit android/app/build.gradle ( NOT android/build.gradle ) and add the following:

apply from: "node_modules/backpack-react-native/bpk-component-icon/fonts.gradle"
iOS

Icons

The most reliable way to install the file on iOS is manually, three simple steps are required:

  1. update the Info.plist file by adding

    <key>UIAppFonts</key>
      <array>
        <string>BpkIcon.ttf</string>
      </array>
    

    if the entry UIAppFonts is already there, just add <string>BpkIcon.ttf</string> inside the <array> like so

    <array>
        ... existing entries
        <string>BpkIcon.ttf</string>
      </array>
    
  2. In the Build Phases of your project, in the section Copy Bundle Resources add a reference to the BpkIcon.ttf file path like /path/to/node_modules/@skyscanner/bpk-svgs/dist/font/BpkIcon.ttf

  3. Rebuild the app

Contributing

To contribute please see contributing.md.

List of packages

Contact

backpack-react-native's People

Contributors

alevinval avatar amolgupta avatar arnaugm avatar chrisbehr avatar craigyoungsheep avatar dependabot-preview[bot] avatar dependabot[bot] avatar detzgk avatar dominicfraser avatar ggsf1 avatar greenkeeper[bot] avatar greenkeeperio-bot avatar k0nserv avatar karanjthakkar avatar ksiwei avatar marianeum avatar matteo-hertel avatar matthewdavidson avatar monikakindernayova avatar olliecurtis avatar raullm7 avatar richardwillis-skyscanner avatar samstradling avatar shaundon avatar snyk-bot avatar sogame avatar tiagoengel avatar tomcorke avatar tvooo avatar wiyarmir avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.