https://github.com/fiberjw/react-native-stylehooks
Responsive React Native styles made simple.
https://github.com/fiberjw/react-native-stylehooks
css expo react react-native style stylesheet
Last synced: 6 months ago
JSON representation
Responsive React Native styles made simple.
- Host: GitHub
- URL: https://github.com/fiberjw/react-native-stylehooks
- Owner: FiberJW
- License: mit
- Created: 2019-11-23T07:27:56.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-01T05:18:39.000Z (almost 5 years ago)
- Last Synced: 2025-01-13T10:01:53.792Z (6 months ago)
- Topics: css, expo, react, react-native, style, stylesheet
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/react-native-stylehooks
- Size: 3.47 MB
- Stars: 46
- Watchers: 3
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
`react-native-stylehooks`
Responsive React Native [Web] styles made simple.---
[](https://github.com/expo/expo)
[](https://github.com/expo/expo)
[](https://github.com/expo/expo)## Getting Started
- Run `yarn add react-native-stylehooks` in your React Native [Web] app
- Use it similarly to the example shown below```jsx
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { View, Text } from 'react-native';
import { StyleSheet } from 'react-native-stylehooks';function App() {
const styles = useStyles();return (
Hello, Stylehooks
);
}const breakpoints = {
tablet: 1024,
mobile: 400,
};const useStyles = StyleSheet.create({
container: ({ window: { width } }) => {
return {
flex: 1,
justifyContent: 'center',
height: '100vh',
alignItems: 'center',
backgroundColor: width <= breakpoints.tablet ? '#4630eb' : '#000020',
borderColor: width <= breakpoints.mobile ? '#decd50' : '#93d9de',
borderWidth: 8,
};
},
text: _ => {
return { color: 'white', fontSize: 32 };
},
});ReactDOM.render(, document.getElementById('root'));
```