Flexbox Layout
Flexbox layout is a new layout system in Voltra. While it covers common use cases, you may encounter bugs or edge cases. Please report any issues you find.
Voltra supports React Native-style flexbox layout through the Voltra.View component.
Enabling Flexbox
Use Voltra.View to opt in to flexbox layout:
Supported Properties
Voltra supports the following flexbox style properties. For detailed explanations and examples of each property, see the React Native Flexbox documentation.
Container Properties
Child Properties
Unsupported Properties
The following React Native flexbox properties are not supported in Voltra:
flexWrap— items are always laid out in a single linerowGap,columnGap— only the unifiedgapproperty is supported, applied along the main axis- Percentage-based
widthorheight(e.g.width: '50%') — useflexGrowinstead
Differences from React Native
If you're coming from React Native, keep these differences in mind:
Flexbox is opt-in
In React Native, every View uses flexbox by default. In Voltra, only Voltra.View uses flexbox. Other containers (VStack, HStack) use native SwiftUI layout.
Gap is single-axis only
React Native supports gap, rowGap, and columnGap. Voltra only supports gap, which applies spacing between children along the main axis (the direction of flexDirection).
No flex wrap
React Native supports flexWrap: 'wrap' to flow items onto multiple lines. Voltra does not — all items stay on a single line and will overflow or shrink.
No percentage dimensions
React Native allows width: '50%' and similar percentage values. In Voltra, use flexGrow for proportional sizing instead.
Next Steps
- React Native Flexbox documentation — comprehensive guide to flexbox properties and concepts
- View component documentation — API reference for
Voltra.View - Styling in Voltra — more about style properties
