# react-native-to-css

> Converts React Native stylesheet object to a CSS text

Latest version **1.1.2** (published 2022-08-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-native-to-css
pnpm add react-native-to-css
yarn add react-native-to-css
bun add react-native-to-css
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2022-08-09 |
| First published | 2022-07-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 8.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | liyananweb |
| Keywords | react-native, styleSheet, typescript, css, less |

## Links

- npm: https://www.npmjs.com/package/react-native-to-css
- npm.io page: https://npm.io/package/react-native-to-css

## Dependencies (1)

- [lodash](https://npm.io/package/lodash.md) latest

## Alternatives

- [style-dictionary](https://npm.io/package/style-dictionary.md) — 2.0M weekly downloads
- [postcss-merge-idents](https://npm.io/package/postcss-merge-idents.md) — 1.7M weekly downloads
- [@fontsource/noto-sans](https://npm.io/package/@fontsource/noto-sans.md) — 93.0K weekly downloads
- [uglifycss](https://npm.io/package/uglifycss.md) — 71.6K weekly downloads
- [mat4-interpolate](https://npm.io/package/mat4-interpolate.md) — 23.3K weekly downloads

## Recent versions

- 1.1.2 (latest) — 2022-08-09
- 1.1.0 — 2022-08-02
- 1.0.9 — 2022-08-02
- 1.0.8 — 2022-07-29
- 1.0.7 — 2022-07-29
- 1.0.6 — 2022-07-28
- 1.0.5 — 2022-07-28
- 1.0.4 — 2022-07-26
- 1.0.3 — 2022-07-25
- 1.0.1 — 2022-07-18
- 1.0.0 — 2022-07-17

## README

# `react-native-to-css`

> Converts React Native stylesheet object to a CSS text

## Usage

```js
import { ViewStyle, TextStyle, ImageStyle } from 'react-native';

export const page: ViewStyle = {
  minHeight: '100%',
  backgroundColor: '#FAFAFB',
  flex: 1,
  zIndex: 1,
};

export const list: ViewStyle = {
  marginTop: 5,
  paddingHorizontal: 15,
};
export const item: ViewStyle = {
  marginTop: 15,
};
```

Will be translated into

```css
page {
  background-color: #fafafb;
  flex: 1;
  z-index: 1;
  display: flex;
}

.list {
  margin-top: 5px;
  padding: 0 15px 0 15px;
}

.item {
  margin-top: 15px;
}
```

When paddingVertical is encountered, it will be translated into padding-top, padding-bottom, Others include marginHorizontal, marginVertical, paddingHorizontal

```js
export const list: ViewStyle = {
  paddingVertical: 2,
};
```

```css
.list {
  padding-top: 2px;
  padding-bottom: 2px;
}
```

# Installation

```JavaScript
npm install --save react-native-to-css
```

# Usage

### Please follow the steps below

1、create `index.js` in root directory

```JavaScript
const reactNativeToCss = require("react-native-to-css");
reactNativeToCss();
```

2、Put the file you want to convert in the root directory of the folder, only supported `Type Script`, for example `test.ts`

3、Execute command `node index.js`, When the command is completed, the corresponding file will be generated

---
_Source: https://npm.io/package/react-native-to-css · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
