UNPKG

@geekyhawks/react-native-ui-components

Version:

A lightweight and reusable React Native UI components library with customizable Text, TextInput, FloatingLabelTextInput, Button, and more. Built with TypeScript, fully typed, and designed for easy integration into any React Native project.

45 lines 1.35 kB
"use strict"; /** * makeStyles Utility * * Provides a convenient way to create themed styles in React Native components. * This file exports the `makeStyles` function, which generates a StyleSheet * based on the current theme from ThemeProvider. * * Author: Geeky Hawks FZE LLC */ Object.defineProperty(exports, "__esModule", { value: true }); exports.makeStyles = void 0; const react_native_1 = require("react-native"); const ThemeContext_1 = require("../ThemeContext"); /** * makeStyles * * Creates a custom hook that generates styles based on the current theme. * * Usage: * const useStyles = makeStyles((theme) => ({ * container: { * backgroundColor: theme.colors.background, * padding: theme.spacing.md, * }, * text: { * color: theme.colors.text, * fontSize: 16, * }, * })); * * // Inside a component: * const styles = useStyles(); * * @param styles - A function that receives the current Theme and returns a StyleSheet object. * @returns A hook that generates the themed StyleSheet. */ const makeStyles = (styles) => { return () => { const { theme } = (0, ThemeContext_1.useTheme)(); return react_native_1.StyleSheet.create(styles(theme)); }; }; exports.makeStyles = makeStyles; //# sourceMappingURL=makeStyles.js.map