UIPackageReact Native
Search

Set up your app

This guide covers Expo SDK 58 and bare React Native 0.88 with the New Architecture, NativeWind 4, Tailwind CSS 3, and Node.js 22 LTS (22.13+) or Node.js 24 LTS (24.3+).

ExpoBare React Native

Initialize and add components

Run these commands from your app directory. The CLI copies editable source, styles, and helpers into your project and lists the dependencies the chosen items need.

npx --yes --package=https://native.uipkge.dev/cli/uipkge-native-0.1.1.tgz uipkge-native init --yes
npx --yes --package=https://native.uipkge.dev/cli/uipkge-native-0.1.1.tgz uipkge-native add button popover order-summary

For an existing app, merge the generated tokens and configuration with your own. By default the installer preserves files that already exist.

Expo

For a fresh app, run npx create-expo-app@latest MyApp --template blank-typescript@58 and open its directory. After the registry commands above, install the dependencies for the sample below.

npx expo install @react-native-async-storage/async-storage react-native-reanimated react-native-worklets react-native-safe-area-context react-native-screens
npm install nativewind@^4.2.7 react-native-css-interop@0.2.7 tailwind-merge@^2 clsx class-variance-authority @rn-primitives/portal@1.5.2 @rn-primitives/popover@1.5.2
npm install --save-dev tailwindcss@^3.4.19 babel-preset-expo@~58.0.0 @babel/plugin-transform-react-jsx@^7.29.7

babel.config.js

module.exports = function (api) {
  api.cache(true)
  return {
    presets: [
      ['babel-preset-expo', { jsxImportSource: 'nativewind' }],
      'nativewind/babel',
    ],
  }
}

metro.config.js

const { getDefaultConfig } = require('expo/metro-config')
const { withNativeWind } = require('nativewind/metro')

module.exports = withNativeWind(getDefaultConfig(__dirname), {
  input: './global.css',
})

Expo Metro resolves the TypeScript alias shown below. With Expo Router, import the generated stylesheet and mount the providers in your root layout. Use ../global.css from app/_layout.tsx or ../../global.css from src/app/_layout.tsx.

Build for a simulator with npx expo run:ios or npx expo run:android after configuring the platform tools. For an existing app with Metro running, restart Metro after changing Babel or Tailwind. Expo environment setup

Bare React Native

For a fresh app, initialize the Community CLI template with npx @react-native-community/cli@20.2.0 init MyApp --version 0.88.0. Then run the registry commands above and install the sample’s dependencies.

npm install --save-exact react-native-reanimated@4.7.1 react-native-worklets@0.13.0
npm install nativewind@^4.2.7 react-native-css-interop@0.2.7 tailwind-merge@^2 clsx class-variance-authority @react-native-async-storage/async-storage@2.2.0 react-native-safe-area-context@~5.11.1 react-native-screens@~4.30.1 @rn-primitives/portal@1.5.2 @rn-primitives/popover@1.5.2
npm install --save-dev tailwindcss@^3.4.19 babel-plugin-module-resolver@^5.0.3 @babel/plugin-transform-react-jsx@^7.29.7

babel.config.js

module.exports = {
  presets: [
    ['module:@react-native/babel-preset', { jsxImportSource: 'nativewind' }],
    'nativewind/babel',
  ],
  plugins: [
    ['module-resolver', { root: ['.'], alias: { '@': './' } }],
    'react-native-worklets/plugin',
  ],
}

metro.config.js

const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config')
const { withNativeWind } = require('nativewind/metro')

const config = mergeConfig(getDefaultConfig(__dirname), {
  resolver: {
    resolveRequest(context, moduleName, platform) {
      if (moduleName === '@rn-primitives/portal') {
        // The portal and its host must share one module instance.
        return context.resolveRequest({ ...context, unstable_enablePackageExports: false }, moduleName, platform)
      }
      return context.resolveRequest(context, moduleName, platform)
    },
  },
})

module.exports = withNativeWind(config, { input: './global.css' })

The Metro resolver keeps the portal and its host on one module instance. This allows popovers and other anchored overlays to appear in a bare app.

Keep react-native-worklets/plugin last in the plugins array. Match Reanimated and Worklets to your React Native version when adding more components. Reanimated compatibility table

Prepare the iOS pods

With Xcode 27, add this block inside post_install in ios/Podfile, immediately after the existing react_native_post_install call. It raises older CocoaPods resource bundles to the app’s React Native iOS minimum.

minimum_ios = Gem::Version.new(min_ios_version_supported)
installer.pods_project.native_targets.each do |target|
  next unless target.product_type == 'com.apple.product-type.bundle'

  target.build_configurations.each do |configuration|
    settings = configuration.build_settings
    version = settings['IPHONEOS_DEPLOYMENT_TARGET']
    next unless version && Gem::Version.correct?(version) && Gem::Version.new(version) < minimum_ios

    settings['IPHONEOS_DEPLOYMENT_TARGET'] = minimum_ios.to_s
  end
end

From the app root, run bundle install, then run bundle exec pod install in ios/. Build with npm run ios or npm run android. Components whose manifests include Expo packages require Expo Modules setup in a bare app.

Render your first screen

Merge this into tsconfig.json

{
  "compilerOptions": {
    "paths": { "@/*": ["./*"] }
  }
}

Keep the generated lib/nativewind-env.d.ts in your TypeScript include paths. If you keep UI in src/ or another location, include those files in tailwind.config.js too.

Use this App.tsx in either starter

import './global.css'
import { useState } from 'react'
import { View } from 'react-native'
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context'
import { Button } from '@/components/ui/button'
import { OrderSummary } from '@/components/blocks/order-summary'
import { Popover, PopoverContent, PopoverTrigger, PopoverClose } from '@/components/ui/popover'
import { Text } from '@/components/ui/text'
import { PortalHost } from '@/lib/portal'
import { ThemeProvider } from '@/lib/theme'

export default function App() {
  const [confirmed, setConfirmed] = useState(false)

  return (
    <SafeAreaProvider>
      <ThemeProvider>
        <SafeAreaView style={{ flex: 1 }}>
          <View className="flex-1 gap-4 bg-background p-4">
            <Text size="xl" accessibilityRole="header">Checkout preview</Text>
            <OrderSummary subtotal="$24.00" shipping="$4.00" total="$28.00" />
            <Popover>
              <PopoverTrigger>Show delivery details</PopoverTrigger>
              <PopoverContent accessibilityLabel="Delivery details">
                <Text>Arrives Friday</Text>
                <PopoverClose>Close details</PopoverClose>
              </PopoverContent>
            </Popover>
            <Button onPress={() => setConfirmed(true)} disabled={confirmed}>
              {confirmed ? 'Order confirmed' : 'Confirm order'}
            </Button>
          </View>
        </SafeAreaView>
        <PortalHost />
      </ThemeProvider>
    </SafeAreaProvider>
  )
}

Mount one PortalHost after the app content, inside ThemeProvider and SafeAreaProvider. Popovers and other portal-based components use it to render above the active screen.

Check the setup before building

npx --yes --package=https://native.uipkge.dev/cli/uipkge-native-0.1.1.tgz uipkge-native doctor
npx tsc --noEmit

The sample should show an order total, open a delivery popover, and let you confirm the order. See NativeWind 4 installation for configuring an existing project.