Skip to content

mgcrea/react-native-jetpack-compose

Repository files navigation

logo

npm version npm total downloads npm monthly downloads npm license
build status dependencies status

Overview

Native Jetpack Compose components for React Native using the Fabric renderer. Build Android forms and interfaces with Material 3 design while maintaining a familiar React workflow.

Features

  • 🤖 Native Jetpack Compose - Real Material 3 components, not web views or custom drawings
  • 🔧 No Dependencies - Safe from supply chain attacks
  • ⚡ Fabric Renderer - Built on React Native's modern architecture
  • 📝 TypeScript-first - Full type safety and autocomplete support
  • 🔄 Two-Way Binding - State syncs between JavaScript and Compose
  • 📋 Form Components - TextField, Picker, SheetPicker, DatePicker, TimePicker
  • 🎨 Material You - Dynamic colors on Android 12+ with system theming
  • 📱 Wide Compatibility - Supports Android 7+ (API level 24)
  • 📦 Zero Config - No complex setup, just install and use

Note: This library is Android-only. For iOS, check out @mgcrea/react-native-swiftui.

Demo

demo

Quick Start

Installation

npm install @mgcrea/react-native-jetpack-compose
# or
pnpm add @mgcrea/react-native-jetpack-compose
# or
yarn add @mgcrea/react-native-jetpack-compose

Requirements

  • React Native 0.76.0+ (New Architecture required)
  • Android API level 24+ (Android 7.0)

Basic Usage

import { useState } from "react";
import { View } from "react-native";
import { TextField, DatePicker, Picker } from "@mgcrea/react-native-jetpack-compose";

export function BookingForm() {
  const [name, setName] = useState("");
  const [date, setDate] = useState<Date | null>(null);
  const [room, setRoom] = useState<string | null>(null);

  return (
    <View style={{ flex: 1, padding: 16, gap: 16 }}>
      <TextField
        label="Guest Name"
        value={name}
        onChange={setName}
      />
      <DatePicker
        label="Check-in Date"
        value={date}
        onConfirm={setDate}
      />
      <Picker
        label="Room Type"
        value={room}
        onChange={setRoom}
        options={[
          { value: "standard", label: "Standard Room" },
          { value: "deluxe", label: "Deluxe Suite" },
          { value: "penthouse", label: "Penthouse" },
        ]}
      />
    </View>
  );
}

How It Works

Components are rendered directly through Jetpack Compose:

  1. React renders JSX - Components receive props and manage state
  2. Props bridge to native - Fabric passes props to Kotlin ViewManagers
  3. Compose renders UI - Native Jetpack Compose renders Material 3 components
  4. Events bridge back - User interactions trigger React callbacks

This means 60fps native performance with no JavaScript layout overhead.

Documentation

📚 Full Documentation

Contributing

Contributions are welcome! To run the example project:

git clone https://github.com/mgcrea/react-native-jetpack-compose.git
cd react-native-jetpack-compose
pnpm install

cd example
pnpm install
pnpm run android

Credits

Authors

MIT License

Copyright (c) 2025 Olivier Louvignes <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Material 3 components for React Native, powered by Jetpack Compose

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published