React Native MantineLayout

Center

Center content both horizontally and vertically

Import: import { Center } from 'react-native-mantine';

Usage

import { Center, Text , Badge } from 'react-native-mantine';

// Basic centering
<Center style={{ height: 100 }}>
  <Text>Centered content</Text>
</Center>

// Full width and height
<Center fullWidth fullHeight>
  <Text>Centered in full container</Text>
</Center>

// With padding
<Center p="xl" style={{ height: 120 }}>
  <Badge>Centered badge</Badge>
</Center>

Props

PropTypeDefaultDescription
childrenReact.ReactNodeContent that should be centered horizontally and vertically
inlinebooleanInline center (not applicable in React Native, prop exists for API compatibility)
styleViewStyleAdditional styles to apply to the center container
pstring | numberPadding on all sides (inherited from BoxView)
pxstring | numberPadding horizontal (inherited from BoxView)
pystring | numberPadding vertical (inherited from BoxView)
ptstring | numberPadding top (inherited from BoxView)
pbstring | numberPadding bottom (inherited from BoxView)
plstring | numberPadding left (inherited from BoxView)
prstring | numberPadding right (inherited from BoxView)
mstring | numberMargin on all sides (inherited from BoxView)
mxstring | numberMargin horizontal (inherited from BoxView)
mystring | numberMargin vertical (inherited from BoxView)
mtstring | numberMargin top (inherited from BoxView)
mbstring | numberMargin bottom (inherited from BoxView)
mlstring | numberMargin left (inherited from BoxView)
mrstring | numberMargin right (inherited from BoxView)
fullWidthbooleanTakes 100% width (inherited from BoxView)
fullHeightbooleanTakes 100% height (inherited from BoxView)

Source on GitHub · npm