All Projects β†’ sanjeevyadavIT β†’ react-native-theme

sanjeevyadavIT / react-native-theme

Licence: GPL-3.0 license
🎨 Build consistent, themeable React Native apps

Programming Languages

typescript
32286 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
java
68154 projects - #9 most used programming language
javascript
184084 projects - #8 most used programming language
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to react-native-theme

bezier-react
React components library that implements Bezier Design System.
Stars: ✭ 85 (+214.81%)
Mutual labels:  design-system
GEL
The Design System and supporting website for Westpac GEL
Stars: ✭ 23 (-14.81%)
Mutual labels:  design-system
fuck-design
ε›žε½’ζœ¬θ΄¨οΌŒθΏ”η’žε½’ηœŸοΌ
Stars: ✭ 70 (+159.26%)
Mutual labels:  design-system
designDoc
A lean product design process in markdown that enables cross-functional teams to take an idea from napkin to scale by prioritizing learnings to produce customer-centered solutions.
Stars: ✭ 28 (+3.7%)
Mutual labels:  design-system
base-design-docs
A documentation site for the Base design system.
Stars: ✭ 22 (-18.52%)
Mutual labels:  design-system
big-design
Design system that powers the BigCommerce ecosystem.
Stars: ✭ 35 (+29.63%)
Mutual labels:  design-system
core
The Pangolin.js core that drives everything.
Stars: ✭ 18 (-33.33%)
Mutual labels:  design-system
design-system
Strapi.io's design system πŸš€
Stars: ✭ 262 (+870.37%)
Mutual labels:  design-system
design-system
Nulogy Design System
Stars: ✭ 61 (+125.93%)
Mutual labels:  design-system
ancestor
πŸ’€ UI primitives for ReScript and React
Stars: ✭ 144 (+433.33%)
Mutual labels:  design-system
uinix-ui
A minimal framework-agnostic and configurable UI system to build UI systems. Your system your rules 🀘.
Stars: ✭ 19 (-29.63%)
Mutual labels:  design-system
rebass
βš›οΈ React primitive UI components built with styled-system.
Stars: ✭ 7,844 (+28951.85%)
Mutual labels:  design-system
ray
Resources for building interfaces with WeWork's design system
Stars: ✭ 55 (+103.7%)
Mutual labels:  design-system
template-design-system-de-l-etat
DΓ©mo du Design System de l'Γ‰tat (ressource non officielle)
Stars: ✭ 33 (+22.22%)
Mutual labels:  design-system
mint-ui
Design System | React UI components for web
Stars: ✭ 17 (-37.04%)
Mutual labels:  design-system
ACCESS-NYC-PATTERNS
ACCESS NYC Pattern library and design system documentation for https://access.nyc.gov. Maintained by @NYCOpportunity
Stars: ✭ 14 (-48.15%)
Mutual labels:  design-system
ui-kit
D2iQ UI Kit
Stars: ✭ 29 (+7.41%)
Mutual labels:  design-system
nextjs-components
A collection of React components, transcribed from https://vercel.com/design.
Stars: ✭ 92 (+240.74%)
Mutual labels:  design-system
orfium-ictinus
This repo will include the building blocks to create the Orfium Parthenons to come ...
Stars: ✭ 20 (-25.93%)
Mutual labels:  design-system
hubble-scripts
πŸ”­ πŸ“œ Transform Sketch config data & assets into dev-friendly formats.
Stars: ✭ 23 (-14.81%)
Mutual labels:  design-system

Work In Progress, though star this repo πŸ˜‰


React Native Theme

React Native theme is a single source of truth for your App Design. It's a scalable theme for your React Native project. You can easily integrate it in your workflow, and modify entire look of your app in seconds. The basic idology can be implemented outside React Native realm.

✨ Inspiration

In entire app, colors, typography and values for margin/padding/height/width are typically defined in each component, which makes it hard to change. This theme module, defines all colors, typography and sizes at a single place, so that only few changes in value can change the overall look of the app.

Table of Contents

  • theme.js - combine colors.js, typography.js, spacing.js & dimens.js into single module
  • colors.js - where all colors used in entire app are defined
  • typography.js - all typography related style are defined
  • spacing.js - common padding/margin value defined
  • dimens.js - component custom width/height are defined here

πŸš€ Getting Started

Instructions

  • Copy the theme folder and place it in your APP.
  • Copy Text component and paste it in your component folder.

Theme

Theme is implemented by creating sepearte file for colors, spacing, typography and combining it in single file, and accessing it using React Context. Follow below steps to import theme object in your component.

For Functional Component

import React, { useContext } from 'react';
import { ThemeContext } from './theme';
//...
const CustomComponent = props => {
    const theme = useContext(ThemeContext);
    //...
    return <View style={{ backgroundColor: theme.colors.background }} />
}

For Class Component

import React from 'react';
import { ThemeContext } from './theme';
//...
class CustomComponent  extends React.Component {
    static contextType = ThemeContext;
    //...
    render() {
        const theme = this.context;
        return <View style={{ backgroundColor: theme.colors.background }} />
   }
}

🎨 Colors

Color palette is inspired(stolen) from Google Material Design. There are two major colors primary which represents brand color and secondary which represents accent color.

Color Name Color Use
primaryDark To be used for status bar and for dark tint
primary To be used as a background color for appbar(toolbar)
appBarTint To be used for appbar title text, appbar icons color and for back button
secondaryLight To be used for hover state
secondary to be used as default button, checkbox, spinner, radio button and other component color
secondaryDark to be used for active state
background Every Screen will have this as his default background color
surface To be used as a default background for all components, like Card, CardSection, List etc
border Use it for card border
titleText To be used for heading, subheading, label text
bodyText To be used for normal text like paragraph
captionText To be used for hint text component, or of less importance
success Success messages and icons.
error Error messages and icons.

TODO: Insert Image to showcase color palette visually.

If primary is dark make appBarTint color light, and vice versa. If surface is dark make titleText, bodyText & captionText light, and vice versa.

βœ”οΈ Do this

<View style={{ backgroundColor: theme.colors.background }}>
    <View style={{ borderColor: theme.colors.border }}>

❌ Don't do this

<View style={{ backgroundColor: '#222' }}>
    <View style={{ borderColor: '#eee' }}>

βœ’οΈ Typography

Name value variant
titleText Use for the title of a screen(Toolbar) & the titles of Modal dialogs bold
headingText Use for card titles bold
subheadingText Use for new sections within cards bold
bodyText Default style bold
labelText Use for form field and input elements bold
captionText Use the for help/hint text bold

TODO: Insert image depicting different text style used in Screen

A custom Text component has been defined in component folder, which uses typography styles from typography.js. Use this Text component to understand how typography is implemented.

<Text type="heading">This is a Heading</Text>
<Text type="subheading">This is a SubHeading</Text>
<Text type="body">This is a Body</Text>
<Text>Default is a Body</Text>
<Text type="label">This is a label</Text>
<Text type="caption">This is a caption</Text>
---
<Text type="heading" bold>This is a Bold Heading</Text>
<Text type="subheading" bold>This is a Bold SubHeading</Text>
<Text type="body" bold>This is a Bold Body</Text>
<Text type="label" bold>This is a Bold label</Text>
<Text type="caption" bold>This is a Bold caption</Text>

Typography

βœ”οΈ Use custom Text component in App

import { Text } from './component/Text'; // import Text component from component folder
//...
return (
    <View>
        <Text>Text which is theme aware</Text>
    </View>
);

❌ Don't do this

import { Text } from 'react-native';

πŸ“ Spacing

Spacing should be consistent and whitespace thought of as a first class technique up there with color and typefaces. Define preset for spacing which will be used for padding and margin value.

Name Value
tiny 4
small 8
medium 12
large 16

If required, add more like extraLarge etc.

βœ”οΈ Do this

<View style={{ padding: theme.spacing.large }}>
    <Text style={{ margin: theme.spacing.tiny }}>

❌ Don't do this

<View style={{ padding: 16 }}>
    <Text style={{ margin: 4 }}>

πŸ“ Dimensions

App contain several cutom values from image height, width to a view border radius. Define all numerical sizes used in app in dimens file.

βœ”οΈ Do this

  • Define custom sizes in dimens file
{
    customComponentHeight: 234,
    customComponentWidth: 345,
    //...
}
  • In you CustomComponent access the property like
<Image style={{
        width: theme.dimens.customComponentWidth,
        height: theme.dimens.customComponentHeight,
    }}>

🀝 Contributing PRs Welcome

⭐ If you like what you see, star us on GitHub.

Finding bugs, sending pull requests or improving docs - any contribution is welcome and highly appreciated. To get started, head over to our contribution guidelines. Thanks!

πŸ“š Projects using this theme module

πŸ‘¨ Authors

See also the list of contributors who participated in this project.

πŸ“„ License

This project is licensed under the GNU v3 Public License License - see the LICENSE.md file for details.

πŸ’‘ Acknowledgements

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].