UI Docs
Squish UI

v1.0.0

Setup

Installation

Use this setup for components in packages/mobile.

  1. 1

    Install React Native testing dependencies

    npm install -D jest @testing-library/react-native @types/jest react-test-renderer
  2. 2

    Use React Native Babel preset in Jest transform

    jest.config.js
    transform: {
      "^.+\\.(js|jsx|ts|tsx)$": [
        "babel-jest",
        { presets: ["module:@react-native/babel-preset"] }
      ]
    }
  3. 3

    Add shared mobile theme hook

    packages/mobile/use-mobile-theme.ts
    import { useColorScheme } from "react-native";
    
    export type MobileTheme = "light" | "dark";
    
    export function useMobileTheme(): MobileTheme {
      return useColorScheme() === "dark" ? "dark" : "light";
    }
  4. 4

    Style components with StyleSheet

    packages/mobile/example/example.tsx
    import { StyleSheet, View } from "react-native";
    import { useMobileTheme } from "@squishui/mobile/use-mobile-theme";
    
    const styles = StyleSheet.create({
      card: { borderRadius: 8, padding: 16 },
    });