UNPKG

@whitemordred/react-native-bootstrap5

Version:

A complete React Native library that replicates Bootstrap 5.3 with 100% feature parity, full theming support, CSS variables, and dark/light mode

55 lines (54 loc) 1.95 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Col = exports.Row = exports.Container = void 0; const react_1 = __importDefault(require("react")); const react_native_1 = require("react-native"); const ThemeProvider_1 = require("../theme/ThemeProvider"); const Container = ({ children, fluid = false, style }) => { const { theme } = (0, ThemeProvider_1.useTheme)(); const containerStyles = { paddingHorizontal: theme.spacing[3], width: '100%', alignSelf: 'center', }; if (!fluid) { containerStyles.maxWidth = 1140; // Bootstrap's max container width } return (<react_native_1.View style={[containerStyles, style]}> {children} </react_native_1.View>); }; exports.Container = Container; const Row = ({ children, style, noGutters = false }) => { const { theme } = (0, ThemeProvider_1.useTheme)(); const rowStyles = { flexDirection: 'row', flexWrap: 'wrap', width: '100%', }; if (!noGutters) { rowStyles.marginHorizontal = -theme.spacing[2]; } return (<react_native_1.View style={[rowStyles, style]}> {children} </react_native_1.View>); }; exports.Row = Row; const Col = ({ children, xs = 12, sm, md, lg, xl, style }) => { const { theme } = (0, ThemeProvider_1.useTheme)(); // For simplicity, we'll use xs as the default breakpoint // In a full implementation, you'd need to use Dimensions API // to determine screen size and apply appropriate column sizes const colWidth = (xs / 12) * 100; const colStyles = { width: `${colWidth}%`, paddingHorizontal: theme.spacing[2], }; return (<react_native_1.View style={[colStyles, style]}> {children} </react_native_1.View>); }; exports.Col = Col;