css-to-rn
v1.0.1
Published
Convert css string to React Native
Downloads
27
Readme
css-to-rn
Convert css string to React Native
What ?
css-to-rn
converts your css style string to React Native. It does not support interpolations so you cannot change styles dynamically based on props.
Install
npm install css-to-rn
or if you use yarn
yarn add css-to-rn
This package depends on react-native
so make sure you've installed it.
Usage
import React from 'react';
import { Text, View } from 'react-native';
import cssToRn from 'css-to-rn';
const styles = cssToRn(
`flex: 1; background-color: hotpink; align-items: center; justify-content: center;`
);
class App extends React.Component {
render() {
return (
<View style={styles}>
<Text>Hello World</Text>
</View>
);
}
}
License
MIT