SwiftUI like layout management
npm install native-layout-stack





SwiftUI like layout management for React Native
This library recreates SwiftUI components in React Native:
Stack
Spacer
- Spacer
- Stacks by Marcin Dziewulski
- react-native-divisible-view by kangsu
- React Native Spacing System by Hirokazu Nakano Tei
First, install the library in your project by npm:
``sh`
$ npm install native-layout-stack
Or Yarn:
`sh`
$ yarn add native-layout-stack
• Connect libary with project using ES6 import:
`js`
import { LayoutProvider, Stack, Spacer } from 'native-layout-stack'
| name | type | description |
| ------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------- |
| padding | Space or [Space] or [Space, Space] or [Space, Space, Space] or [Space, Space, Space, Space] | Outer space |
| spaces | Space | Space between children |
| omitNull | boolean | Skip elements that are null or React.Fragment |
| arrayDivision | boolean | |
| debug | boolean | Add random color to spaces |
Stack extends ViewProps and implements all LayoutProvider props without debug
Component uses ViewProps
| name | type |
| -------- | ---------------- |
| Space | number or string |
`jsx
import { LayoutProvider, Stack, Spacer } from 'native-layout-stack'
const MyComponent = () => {
return (
)
}
const App = () => {
return (
)
}
export default App
``
This project is licensed under the MIT License © 2020-present Jakub Biesiada