Skip to main content
Version: 0.1.5

Getting Started

Introduction

React Native Smart Styles is designed to streamline the creation of style sheets in React Native projects by automatically adjusting styles to accommodate different screen sizes. This package handles all the heavy lifting, allowing developers to write styles quickly and easily without the need to manually account for device variability.

Installation

To install the package, run the following command in your terminal:

 npm install react-native-smart-styles
# or
yarn add react-native-smart-styles

# after install
pod install

Configuration

On installation

You can customize font names and colors by creating a smart-styles.config.json file in the root of your project. This JSON file allows you to specify your preferences which will be automatically applied during the package installation. Here’s an example of what the file might look like:

{
"fonts": {
"primary": "Arial",
"secondary": "Roboto"
},
"colors": {
"primary": "#333",
"accent": "#007bff"
},
"baseWidth": 375,
"baseHeight": 812
}

Using CLI

If you need to update your configuration after installation or if the smart-styles.config.json file does not exist, you can use the provided CLI tool. Simply run the following command:

smart-styles update

This command updates the configuration based on the settings specified in smart-styles.config.json.

warning

Things should work out of the box after updating the config file, if some things won't work, re-run the app