react-native-full-responsive
Version:
Create a fully responsive React Native app for all supported platforms
28 lines • 876 B
JavaScript
import { StyleSheet } from 'react-native';
import { recursiveMapping } from './mapping/recursiveMapping';
/**
* Creating responsive styles, instead of using `StyleSheet.create({})`, you can use `createRStyle` (create responsive style)
* to generate your responsive styles for your components.
* ```ts
* const styles = createRStyle({
* container: {
* flex: 1,
* },
* box: {
* width: '10rw', //instead of using responsiveWidth method
* height: '20rh', //instead of using responsiveHeight method
* },
* text: {
* fontSize: '10rs', //instead of using responsiveScale method
* },
* //...
* })
* ```
* @param styles
* @param styleConfig
*/
export const createRStyle = (style, styleConfig) => {
const responsivedStyles = recursiveMapping(style, styleConfig);
return StyleSheet.create(responsivedStyles);
};
//# sourceMappingURL=index.js.map