Convert React Native styles into SwiftUI or Jetpack Compose modifiers.
npm install expo-style-bridge

expo-style-bridge is a style transformation library that automatically converts React Native StyleSheet properties into native SwiftUI modifiers (iOS) and Jetpack Compose modifiers (Android). Perfect for developers building cross-platform apps with Expo who need to integrate native UI components while maintaining consistent styling.
- š Seamless conversion from React Native styles to native platform modifiers
- š± Cross-platform support for iOS (SwiftUI) and Android (Jetpack Compose)
- šØ Type-safe styling with full TypeScript support
- ā” Zero runtime overhead - compile-time transformations
- š§© Modular architecture - use only what you need
- š§ Extensible - easily add custom style converters
``typescript
import { convertToSwiftUIModifiers } from 'expo-style-bridge';
import { Button } from '@expo/ui/swift-ui';
const style = {
padding: 16,
opacity: 0.8,
zIndex: 10,
display: 'none',
overflow: 'hidden'
};
const modifiers = convertToSwiftUIModifiers(style); // modifiers is an array
// Use the modifiers with a SwiftUI component
`
Install via npm, yarn, or pnpm:
`bash`
npm install expo-style-bridgeor
yarn add expo-style-bridgeor
pnpm add expo-style-bridge
Transform React Native StyleSheet properties into native platform equivalents:
- Padding: padding, paddingHorizontal, paddingVertical, paddingTop, paddingBottom, paddingLeft, paddingRight ā SwiftUI .padding() opacity
- Opacity: ā SwiftUI .opacity()zIndex
- Layout: ā SwiftUI .zIndex()display
- Visibility: ā SwiftUI .hidden()overflow
- Clipping: ā SwiftUI .clipped()backgroundColor
- Colors: , color ā SwiftUI .background() / .foregroundColor()
Upcoming style property support:
- Gradients
- Border styling (width, radius, color)
- Shadow and elevation
- Transforms (rotate, scale, translate)
- Flexbox layout properties
- Jetpack compose
``
src/
āāā index.ts # Main converter with reducer pattern
āāā types.ts # TypeScript type definitions
āāā mappers/ # Individual style converters
āāā padding/
āāā opacity/
āāā zIndex/
āāā hidden/
āāā clipped/
Each mapper is a self-contained converter with tests. To add a new converter:
1. Create a folder in src/mappers/src/index.ts
2. Implement the converter function
3. Add tests
4. Integrate into the reducer chain in
- Expo Native Modules: Integrate custom native UI components with React Native styling
- Hybrid Apps: Build apps that mix React Native and native views seamlessly
- Migration Projects: Gradually migrate from React Native to native platforms
- Design Systems: Maintain consistent styling across React Native and native components
- Performance Optimization: Leverage native rendering while keeping React Native DX
- @expo/ui >= 0.2.0-beta.7react-native` >= 0.82.0
-
- TypeScript >= 4.0 (recommended)
- @expo/ui - Expo's native UI component library
- React Native - Build native apps using React
- Expo - Framework for universal React applications
Contributions are welcome! Please read our contributing guidelines and submit PRs for new style converters or improvements.
MIT Ā© LabLamb