npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-native-max-width-wrapper

v1.0.2

Published

A React Native component that wraps content with a maximum width

Readme

React Native Max Width Wrapper

npm version npm downloads License

A lightweight, responsive container component for React Native that wraps content with a maximum width constraint, ensuring consistent layouts across different screen sizes.

Features

  • 🌐 Responsive Design - Adapts content to any screen size while respecting maximum width
  • 🎨 Customizable - Easily style the wrapper to match your design system
  • 🧩 TypeScript Support - Full TypeScript definitions for improved developer experience
  • 📱 Cross Platform - Works on iOS, Android, and React Native Web

Installation

# Using npm
npm install react-native-max-width-wrapper

# Using yarn
yarn add react-native-max-width-wrapper

# Using pnpm
pnpm add react-native-max-width-wrapper

Usage

import React from 'react';
import { Text, Button, ScrollView } from 'react-native';
import MaxWidthWrapper from 'react-native-max-width-wrapper';

function MyScreen() {
  return (
    <ScrollView>
      <MaxWidthWrapper>
        <Text>This content will have a maximum width!</Text>
        <Button title="Press me" onPress={() => alert('Button pressed')} />
      </MaxWidthWrapper>
    </ScrollView>
  );
}

Custom width and styling

<MaxWidthWrapper 
  maxWidth={800} 
  style={{ 
    backgroundColor: '#f5f5f5',
    paddingVertical: 20,
    borderRadius: 8
  }}
>
  <Text>Content with custom max width and styling</Text>
</MaxWidthWrapper>

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | children | ReactNode | Required | The content to be wrapped by the component | | maxWidth | number | 600 | The maximum width in pixels that the wrapper will expand to | | style | StyleProp | undefined | Additional styles to apply to the wrapper component |

Examples

Basic Example

import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import MaxWidthWrapper from 'react-native-max-width-wrapper';

export default function App() {
  return (
    <View style={styles.container}>
      <MaxWidthWrapper>
        <Text style={styles.title}>Welcome to My App!</Text>
        <Text style={styles.paragraph}>
          This content is constrained by the MaxWidthWrapper.
          It will never exceed the maximum width (600px by default),
          ensuring a consistent layout across different device sizes.
        </Text>
      </MaxWidthWrapper>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    paddingTop: 50,
  },
  title: {
    fontSize: 24,
    fontWeight: 'bold',
    marginBottom: 16,
  },
  paragraph: {
    fontSize: 16,
    lineHeight: 24,
  },
});

Different widths for different components

import React from 'react';
import { ScrollView, Text, StyleSheet } from 'react-native';
import MaxWidthWrapper from 'react-native-max-width-wrapper';

export default function BlogScreen() {
  return (
    <ScrollView style={styles.container}>
      {/* Header with full width background but content constrained */}
      <View style={styles.header}>
        <MaxWidthWrapper maxWidth={800}>
          <Text style={styles.headerTitle}>My Blog</Text>
        </MaxWidthWrapper>
      </View>
      
      {/* Blog content with narrower max width for better readability */}
      <MaxWidthWrapper maxWidth={650}>
        <Text style={styles.articleTitle}>How to Use MaxWidthWrapper</Text>
        <Text style={styles.articleBody}>
          Content is more readable when it's not too wide. Research shows
          that optimal line length for readability is around 50-75 characters.
          Using MaxWidthWrapper helps maintain this optimal width.
        </Text>
      </MaxWidthWrapper>
    </ScrollView>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
  },
  header: {
    backgroundColor: '#007bff',
    paddingVertical: 24,
    width: '100%',
  },
  headerTitle: {
    fontSize: 28,
    fontWeight: 'bold',
    color: '#fff',
  },
  articleTitle: {
    fontSize: 24,
    fontWeight: 'bold',
    marginTop: 24,
    marginBottom: 16,
  },
  articleBody: {
    fontSize: 16,
    lineHeight: 26,
  },
});

Common Use Cases

  • Content pages where you want to limit the maximum width for readability
  • Forms that shouldn't stretch too wide on large screens
  • Creating consistent layouts that work on both mobile and tablet/web
  • Implementing responsive designs with controlled maximum dimensions

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.