GithubHelp home page GithubHelp logo

craigcoles / react-native-ui-lib Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wix/react-native-ui-lib

0.0 0.0 0.0 39.08 MB

UI Components Library for React Native

Home Page: https://wix.github.io/react-native-ui-lib/

License: MIT License

Java 5.88% JavaScript 48.49% Objective-C 6.94% Shell 0.08% Ruby 0.30% Starlark 0.23% Objective-C++ 0.31% TypeScript 36.18% SCSS 1.59%

react-native-ui-lib's Introduction

UI Toolset & Components Library for React Native


Build Status npm NPM Downloads Follow on Twitter

Check out our Docs.
Our Discord Channel

Download our Expo demo app

(You will need the Expo App)

Installing

See setup instructions here.

New Major Version 5.0

See breaking changes

For React Native >= 0.60.0

please use react-native-ui-lib

For React Native < 0.60.0

please use react-native-ui-lib@^3.0.0

Create your own Design System in 3 easy steps

Step 1

Load your foundations and presets (colors, typography, spacings, etc...)

// FoundationConfig.js

import {Colors, Typography, Spacings} from 'react-native-ui-lib';

Colors.loadColors({
  primaryColor: '#2364AA',
  secondaryColor: '#81C3D7',
  textColor: '##221D23',
  errorColor: '#E63B2E',
  successColor: '#ADC76F',
  warnColor: '##FF963C'
});

Typography.loadTypographies({
  heading: {fontSize: 36, fontWeight: '600'},
  subheading: {fontSize: 28, fontWeight: '500'},
  body: {fontSize: 18, fontWeight: '400'},
});

Spacings.loadSpacings({
  page: 20,
  card: 12,
  gridGutter: 16
});

Step 2

Set default configurations to your components

// ComponentsConfig.js

import {ThemeManager} from 'react-native-ui-lib';

// with plain object
ThemeManager.setComponentTheme('Card', {
  borderRadius: 8
});

// with a dynamic function
ThemeManager.setComponentTheme('Button', (props, context) => {
  // 'square' is not an original Button prop, but a custom prop that can
  // be used to create different variations of buttons in your app
  if (props.square) {
    return {
      borderRadius: 0
    };
  }
});

Step 3

Use it all together. Your configurations will be applied on uilib components so you can use them easily with modifiers.

// MyScreen.js

import React, {Component} from 'react';
import {View, Text, Card, Button} from 'react-native-ui-lib';

class MyScreen extends Component {
  render() {
    return (
      <View flex padding-page>
        <Text heading marginB-s4>My Screen</Text>
        <Card height={100} center padding-card marginB-s4>
          <Text body>This is an example card </Text>
        </Card>
        
        <Button label="Button" body bg-primaryColor square></Button>
      </View>
    );
  }
}

react-native-ui-lib's People

Contributors

7laria avatar aarongreenwald avatar ahmadkhudeish avatar andykog avatar arnonz avatar artald avatar bogobogo avatar d4vidi avatar dor256 avatar doronpr avatar effanuel avatar emilisb avatar ethanshar avatar gongreg avatar inbal-tish avatar lex111 avatar lidord-wix avatar m-i-k-e-l avatar mendyedri avatar niryo avatar noomorph avatar oleksiikuchma-wix avatar rghorbani avatar roiberlin avatar skuzoluk avatar trofima avatar yedidyak avatar yershalom avatar yginton avatar ykravv 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.