Skip to main content

Block

Block

This component is the main component block used to build everything in Galio and any type of layout. There are so many props available for easier access to different styling options that you'll rarely write another style prop.

Usage

Imports:

import { Block } from 'galio-framework';

Simple example:

<Block>{children}</Block>

Advanced examples:

<Block 
flex
row
space="between"
style={{ padding: 20 }}
>
<Text>Left content</Text>
<Text>Right content</Text>
</Block>

<Block
card
shadow
style={{ margin: 10 }}
>
<Text>Card content</Text>
</Block>

Props

PropTypeDefaultDescription
childrennodenullBlock content
bottomboolfalsealignItems: 'flex-end' alignSelf: 'flex-end'
cardboolfalseChanges the View's border-radius, -width and -color
centerboolfalsealignItems: 'center' alignSelf: 'center'
flexbool, numberfalseflex: 1 or custom flex value
fluidboolfalsewidth: 'auto'
heightnumbernullChanges the height of the Block
leftboolfalsealignItems: 'flex-start'
middleboolfalsealignItems: 'center' alignSelf: 'center'
rightboolfalsealignItems: 'flex-end'
rowboolfalseflexDirection: 'row'
safeboolfalseWraps the Block with a SafeAreaView
shadowboolfalseAdds shadow on the Block
shadowColorstringnullChanges the shadow's color
spacestringnullOptions: 'between', 'around' or 'evenly'
styleobjectnullCustom styles
widthnumbernullChanges the width of the Block
...View.props--All React Native View props are supported