MCPcopy Index your code
hub / github.com/andrew-levy/react-native-stacks

github.com/andrew-levy/react-native-stacks @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
4 symbols 14 edges 11 files 0 documented · 0%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

"Buy Me A Coffee"

react-native-stacks :pancakes:

SwiftUI inspired Stack and Spacer components.

stacks Image from Design + Code

  • VStack: Vertical Stack
  • HStack: Horizontal Stack
  • ZStack: Overlay Stack
  • Spacer: Spacing within Stacks

Installation

yarn add react-native-stacks

Usage

import React from "react";
import { Text, Button } from "react-native";
import { VStack, HStack, Spacer } from "react-native-stacks";

function Example() {
  return (
    <VStack aligmment="leading" spacing={20}>
      <Text>Orders</Text>
      <Spacer />
      <HStack>
        <Button onPress={add} title="Add" />
        <Spacer />
        <Button onPress={remove} title="Remove" />
      </HStack>
    </VStack>
  );
}

vs. SwiftUI...

struct Example: View {
  var body: some View {
    VStack(alignment: .leading, spacing: 20) {
      Text("Orders")
      Spacer()
      HStack() {
        Button(action: add) {
          Text("Add")
        }
        Spacer()
        Button(action: remove) {
          Text("Remove")
        }
      }
    }
  }
}

Documentation

<VStack />

A vertical stack.

Props:

spacing

The amount of space between each item in the stack.

required: no

type: number

default: 0

alignment

The horizontal alignment for the stack items.

required: no

type: VStackAlignment

default: 'center'

type VStackAlignment = "leading" | "center" | "trailing";

<HStack />

A horizontal stack.

Props:

spacing

The amount of space between each item in the stack.

required: no

type: number

default: 0

alignment

The vertical alignment for the stack items.

required: no

type: HStackAlignment

default: 'center'

type HStackAlignment = "top" | "center" | "bottom";

<ZStack />

An overlay stack.

Props:

alignment

The horizontal and vertical alignment for the stack items. Since a ZStack overlays items on top of one another, we are able to align them both vertically and horizontally.

required: no

type: ZStackAlignment

default: 'center'

type ZStackAlignment =
  | "top"
  | "center"
  | "bottom"
  | "leading"
  | "trailing"
  | "topLeading"
  | "topTrailing"
  | "bottomLeading"
  | "bottomTrailing";

<Spacer />

A component to provide space between stack items. Spacers will fill the available space between components.

Core symbols most depended-on inside this repo

HStack
called by 0
src/views/HStack/HStack.tsx
ZStack
called by 0
src/views/ZStack/ZStack.tsx
VStack
called by 0
src/views/VStack/VStack.tsx
Spacer
called by 0
src/views/Spacer/Spacer.tsx

Shape

Function 4

Languages

TypeScript100%

Modules by API surface

src/views/ZStack/ZStack.tsx1 symbols
src/views/VStack/VStack.tsx1 symbols
src/views/Spacer/Spacer.tsx1 symbols
src/views/HStack/HStack.tsx1 symbols

For agents

$ claude mcp add react-native-stacks \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact